Michael_fogel writes: > Hello > > For my diploma thesis I have to implement a new back-end for GCC. > The microcontroller is based on an FPGA and was developed one year ago. > Only an Assembler is available and now my university lecturer wants an C > compiler too. I decided to use GCC in version 4.2.1 as basis for the new > compiler. > > I started with an new target, defined the mandatory target macros and > implemented the instruction patterns. > > After i few tries i was able to compile my first file. Now I try to make > the optimization working, but there is a problem i can not solve. > Compiling the following code with activated optimization comes up with > an error message. > > > #define RAM_ADDRESS 0 > #define SERIAL_OFFSET 800 > > void ReadSerialNumber(void) { > int SerialNumber, c; > char *s; > > SerialNumber = 0; > s = (char*)(RAM_ADDRESS + SERIAL_OFFSET); > while ((c = *s - '0') <= 9){ > SerialNumber = 10*SerialNumber + c; > s++; > } > > // ... > } > > test.c: In function 'ReadSerialNumber': > test.c:40: internal compiler error: in create_mem_ref, at > tree-ssa-address.c:677 > Please submit a full bug report, > > adding an volatile > > volatile char *s; > > > fixes it but I think the real problem is somewhere else.
Are you telling us that you have got all this way with gcc, but you have *never* debugged it with gdb? If so, this is the time to learn. Run "gcc -v" to see te args passed to cc1, break out gdb, and start debugging the ICE. A clue: /* Verify that the address is in the simplest possible shape (only a register). If we cannot create such a memory reference, something is really wrong. */ gcc_assert (parts.symbol == NULL_TREE); gcc_assert (parts.index == NULL_TREE); gcc_assert (!parts.step || integer_onep (parts.step)); gcc_assert (!parts.offset || integer_zerop (parts.offset)); gcc_unreachable (); Andrew.