Hello, List!
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 type <pointer_type 0x4018ec3c type <pointer_type 0x4018ea8c Eepromptr type <record_type 0x4018e510 Eepromtype> unsigned SI size <integer_cst 0x40139888 constant invariant 32> unit size <integer_cst 0x401398a0 constant invariant 4> align 32 symtab 0 alias set -1 main_variant <pointer_type 0x4018ea8c Eepromptr> pointer_to_this <pointer_type 0x4018ec3c>> unsigned SI size <integer_cst 0x40139888 32> unit size <integer_cst 0x401398a0 4> align 32 symtab 0 alias set -1 main_variant <pointer_type 0x4018ec3c>> used unsigned ignored SI file test.pas line 26 size <integer_cst 0x40139888 32> unit size <integer_cst 0x401398a0 4> align 32 context <function_decl 0x4018ee58 Eep> (reg/f:SI 0 ax [orig:63 Eepromstor.155419 ] [63]) chain <var_decl 0x40191144 D.606>> 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
Offending program:
program test;
type LinesInfoPtr = ^LinesInfoType; LinesInfoType = array [0..99] of word;
type
EEPROMType = record LinesInfo: word; end;
type StoragePtr = ^StorageType; StorageType = array [0..99] of byte;
type EEPROMPtr = ^EEPROMType;
var EEPROMStor: StoragePtr; EEPROMData: EEPROMPtr absolute EEPromStor;
function EEP ( W: word): pointer;
begin EEP := pointer (word (EEPromData) + W) end;
function EAdvLineInfo (Line: ShortWord): word; begin EAdvLineInfo := LinesInfoPtr (EEP (EEPROMData^.LinesInfo))^ [Line]; end;
begin writeln (integer (EAdvLineInfo (1))); end. ~
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)
Hello Waldek,
WH> 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
WH> Thanks for the report. The following should fix it:
Thank you, Waldek, it works fine now.
Best regards, Igor Marnat mailto:marny@rambler.ru