Igor Marnat wrote:
Trying to build the program below using gpc 20060325 based on gcc 4.0.3 I've got "Internal compiler error". Sorry for a bit complicated test program but it's the simplest one I could produce to reproduce the bug.
Error message: [igor@marnat2 internal_compiler_error]$ make gpc --automake test.pas <var_decl 0x401910d8 Eepromstor.155419
<snip>
test.pas: In function `EAdvLineInfo': test.pas:31: internal compiler error: in expand_expr_real_1, at expr.c:6800 Please submit a full bug report, with preprocessed source if appropriate. See URL:http://www.gnu-pascal.de/todo.html for instructions. make: *** [all] Error 1
Thanks for the report. The following should fix it:
Index: declarations.c =================================================================== RCS file: /mn/a8/cvsroot/gpc/p/declarations.c,v retrieving revision 1.19 diff -u -p -r1.19 declarations.c --- declarations.c 3 Sep 2006 20:03:27 -0000 1.19 +++ declarations.c 3 Sep 2006 20:03:58 -0000 @@ -1737,6 +1737,9 @@ check_identifier (tree id) { gcc_assert (DECL_INITIAL (decl)); decl = DECL_INITIAL (decl); +#ifdef GCC_4_0 + decl = unshare_expr (decl); +#endif } /* Set DECL_NONLOCAL if var is inherited in local routine (not for CONST_DECLs). */ else if (DECL_P (decl) && DECL_CONTEXT (decl) && DECL_CONTEXT (decl) != current_function_decl)