From: SourceForge.net <no...@so...> - 2007-07-13 12:29:41
|
Bugs item #868103, was opened at 2003-12-30 21:09 Message generated for change (Comment added) made by maartenbrock You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=868103&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Icode generator Group: fixed >Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: Ico Doornekamp (zevv) Assigned to: Maarten Brock (maartenbrock) Summary: gen.c line 7593 : need pointerCode Initial Comment: Compiling the following source generates the error message : $ sdcc main.c main.c:14: error: FATAL Compiler Internal Error in file 'gen.c' line number '7593' : need pointerCode Contact Author with source code --------------------------- #include <stdlib.h> struct foo { char *bar[2]; }; int main(void) { struct foo f; f.bar[1] = NULL; return 0; } --------------------------- $ sdcc -v SDCC : mcs51/gbz80/z80/avr/ds390/pic14/pic16/TININative/xa51/ds400/h c08 2.3.5 (Nov 19 2003) (UNIX) OS: Linux / debian Mail: sd...@ze... ---------------------------------------------------------------------- >Comment By: Maarten Brock (maartenbrock) Date: 2007-07-13 14:29 Message: Logged In: YES user_id=888171 Originator: NO Enabled the test and fixed the bug in SDCC 2.7.2 #4882. ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2007-07-11 16:20 Message: Logged In: YES user_id=888171 Originator: NO It appears this bug is no longer tested and when reenabled it fails the assertion. ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2004-09-08 07:52 Message: Logged In: YES user_id=888171 Fixed in SDCC 2.4.4 #831 ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2004-08-26 22:17 Message: Logged In: YES user_id=888171 Update: I've been tracking this one down and it boils down to some strange architecture in SDCC. It starts calculating the address of the struct member without actually inserting "address of" or dereference iCodes. It only sets the isaddr bit. Later on when it's too late it looks at this bit and if it's no pointer yet, it gets turned into a pointer. Next time around it will be a pointer and it won't be turned into pointer again. But if the struct member was a pointer to begin with there's no way to fix things. This is called a "small kludge" (?) in the source code (SDCCcse.c line 1897). ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2004-04-20 21:02 Message: Logged In: YES user_id=888171 This bug is easily reproduced using SDCC 2.4.0 or 2.4.1. It looks like the address of the combination of a pointer array in a struct gets the storage class of the pointer. In this case the compiler tries to store the generic NULL-pointer at a generic-pointed-to address instead of an address in data- memory. If you add a storage class to the bar pointer you get these results: char data *bar[2]; // works char idata *bar[2]; // works char pdata *bar[2]; //NULL written in wrong memory char xdata *bar[2]; //NULL written in wrong memory char code *bar[2]; // FATAL... char *bar[2]; // FATAL... I just can't seem to pinpoint where this pointer gets set. Greets, Maarten ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=868103&group_id=599 |