From: SourceForge.net <no...@so...> - 2008-03-27 14:14:24
|
Bugs item #1503239, was opened at 2006-06-09 02:33 Message generated for change (Comment added) made by patryks You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1503239&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: pic16 target Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Steven Borley (sjborley) Assigned to: Nobody/Anonymous (nobody) Summary: Internal error: validateLink failed Initial Comment: Try... typedef struct { int A; int B; } my_t; my_t foo; const int * code bob = &foo.A; // fails with this void main(void) { // volatile int * hope = &foo.B; // uncomment this line to avoid error! // volatile int hope = foo.B; // or this line } then... sdcc -mpic16 -p18f8620 test.c test.c:11: error 25: Structure/Union expected left of '.->' Internal error: validateLink failed in SPEC_SCLS(cexpr->etype) @ SDCCast.c:1436: expected SPECIFIER, got null-link sdcc -v SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ ds400/hc08 2.5.6 # (May 18 2006) (UNIX) ---------------------------------------------------------------------- Comment By: Patryk (patryks) Date: 2008-03-27 15:14 Message: Logged In: YES user_id=1788180 Originator: NO Moving these pointers to ROM: char * __code Ptr1 = &(Str.t[0]); char * __code Ptr2 = Str.t; // compile error 129: pointer types incompatible generates compile error. ---------------------------------------------------------------------- Comment By: Patryk (patryks) Date: 2008-03-27 15:03 Message: Logged In: YES user_id=1788180 Originator: NO MCS51 port suffers from very similar bug (case is simpler - no storage space issues): struct { char t[1]; } Str = { { 0 } }; char * Ptr1 = &(Str.t[0]); // this works char * Ptr2 = Str.t; // causes internal compiler error Internal error: validateLink failed in SPEC_OCLS(AST_SYMBOL(cexpr)->etype) @ /home/sdcc-builder/build/sdcc-build/orig/sdcc/src/SDCCast.c:1492: expected SPECIFIER, got null-link Error is same except SPEC_OCLS instead of SPEC_SCLS. sdcc -c Source8.c SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.8.0 #5117 (Mar 23 2008) (MINGW32) ---------------------------------------------------------------------- Comment By: Steven Borley (sjborley) Date: 2006-09-30 11:31 Message: Logged In: YES user_id=1270801 Virgilio, This may appear to be academic, but please remember that the example I supplied is significantly cut down, so as to just demonstrate the problem. Or are you are suggesting this is invalid code? I belive it is valid C, and SDCC compiles it correctly with non PIC targets. BTW, this still fails to compile with snapshot #4376 Regards, Steven ---------------------------------------------------------------------- Comment By: Virgilio Eng. Villatora (vvillatora) Date: 2006-09-30 10:44 Message: Logged In: YES user_id=1610032 This is academic... What is the need to assign to a ROM variable the address of a data variable (or a part of it) ? ---------------------------------------------------------------------- Comment By: Steven Borley (sjborley) Date: 2006-07-09 13:21 Message: Logged In: YES user_id=1270801 While looking for an acceptable workaround for this bug in my code I have discovered an even simpler case that shows the problem (file attached). typedef struct { int A; } my_t; my_t foo; const my_t * code bar = &foo; run... sdcc -S -mpic16 -p18f8620 test2.c Internal error: validateLink failed in SPEC_SCLS(cexpr->etype) @ /home/ users/s/sd/sdcc-builder/build/sdcc-build/orig/sdcc/src/SDCCast.c:1518: expected SPECIFIER, got null-link sdcc -v SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/ hc08 2.5.6 #4280 (Jul 9 2006) (UNIX) Note that if foo is made extern to the file (extern my_t foo) then there is no error. Does that hint at what the fault is due to? Regards, steven ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1503239&group_id=599 |