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.
thanks for you help
best regards
Michael Fogel