Missing braces in Updates.h macro
Donald Bruce Stewart
dons at cse.unsw.edu.au
Thu Sep 2 00:11:06 EDT 2004
dons:
> dons:
> > Hey,
> >
> > As you might have seen, last night's head on OpenBSD failed with:
> >
> > ../../ghc/compiler/ghc-inplace -optc-O -optc-Wall -optc-W -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-Wbad-function-cast -optc-I../includes -optc-I. -optc-Iparallel -optc-DCOMPILING_RTS -optc-fomit-frame-pointer -H16m -O -O2 -static -#include Prelude.h -#include Rts.h -#include RtsFlags.h -#include RtsUtils.h -#include StgRun.h -#include Schedule.h -#include Printer.h -#include Sanity.h -#include Storage.h -#include SchedAPI.h -#include Timer.h -#include Itimer.h -#include ProfHeap.h -#include LdvProfile.h -#include Profiling.h -#include Apply.h -fvia-C -dcmm-lint -c Interpreter.c -o Interpreter.o
> > Interpreter.c: In function `interpretBCO':
> > Interpreter.c:405: syntax error before `const'
> > Interpreter.c:405: `info' undeclared (first use in this function)
> > Interpreter.c:405: (Each undeclared identifier is reported only once
> > Interpreter.c:405: for each function it appears in.)
> > gmake: *** [Interpreter.o] Error 1
> >
> > I tracked this down, and it looks like it is barfing on the occurence of
> > DECLARE_IPTR(info) in UPD_REAL_IND. A similar situation occurs in
> > Schedule.c:3218: "syntax error before `const'". Looks like it is because
> > of the decl not appearing at the start of a block.
> >
> > It is still a bit mysterious -- as the head is building fine on linux
> > each night. Any gcc hackers know why this could be? I'm using 2.95.3
> > here.
> >
> > The following patch makes these cases compile.
> >
> > -- Don
> >
> > ------------------------------------------------------------------------
> > --- Updates.h.orig Thu Sep 2 11:25:31 2004
> > +++ Updates.h Thu Sep 2 11:25:36 2004
> > @@ -57,13 +57,15 @@
> > if you *really* need an IND use UPD_REAL_IND
> > */
> > #define UPD_REAL_IND(updclosure, ind_info, heapptr, and_then) \
> > + { \
> > DECLARE_IPTR(info); \
> > info = GET_INFO(updclosure); \
> > AWAKEN_BQ(info,updclosure); \
> > updateWithIndirection(GET_INFO(updclosure), ind_info, \
> > updclosure, \
> > heapptr, \
> > - and_then);
> > + and_then); \
> > + }
>
> Ah, but it looks like adding braces to the macro then breaks its use Cmm code:
>
> ../../ghc/compiler/ghc-inplace -H16m -O -O2 -static -#include Prelude.h -#include Rts.h -#include RtsFlags.h -#include RtsUtils.h -#include StgRun.h -#include Schedule.h -#include Printer.h -#include Sanity.h -#include Storage.h -#include SchedAPI.h -#include Timer.h -#include Itimer.h -#include ProfHeap.h -#include LdvProfile.h -#include Profiling.h -#include Apply.h -fvia-C -dcmm-lint -c Updates.cmm -keep-tmp-files -o Updates.o
> Updates.cmm:61:160: parse error on input `{'
>
> This is occuring in the use of UPD_REAL_IND, by UPD_SPEC_IND in
> UPD_FRAME_ENTRY_TEMPLATE, in Updates.cmm.
>
> Maybe Simon has a better idea what is going on here?
Explicitly wrapping braces around the two uses of UPD_IND in C code that
don't compile let the entire rts go through. Yay. Patch below.
Still don't know why this isn't happening on the nightly build machines.
-- Don
------------------------------------------------------------------------
Index: Interpreter.c
===================================================================
RCS file: /cvs/fptools/ghc/rts/Interpreter.c,v
retrieving revision 1.47
diff -u -u -r1.47 Interpreter.c
--- Interpreter.c 13 Aug 2004 13:10:02 -0000 1.47
+++ Interpreter.c 2 Sep 2004 04:09:08 -0000
@@ -402,7 +402,9 @@
// Returning to an update frame: do the update, pop the update
// frame, and continue with the next stack frame.
INTERP_TICK(it_retto_UPDATE);
+ {
UPD_IND(((StgUpdateFrame *)Sp)->updatee, obj);
+ }
Sp += sizeofW(StgUpdateFrame);
goto do_return;
Index: Schedule.c
===================================================================
RCS file: /cvs/fptools/ghc/rts/Schedule.c,v
retrieving revision 1.201
diff -u -u -r1.201 Schedule.c
--- Schedule.c 19 Aug 2004 11:27:45 -0000 1.201
+++ Schedule.c 2 Sep 2004 04:09:09 -0000
@@ -3215,7 +3215,9 @@
SET_HDR(raise_closure, &stg_raise_info, CCCS);
raise_closure->payload[0] = exception;
}
+ {
UPD_IND(((StgUpdateFrame *)p)->updatee,raise_closure);
+ }
p = next;
continue;
More information about the Cvs-ghc
mailing list