From: SourceForge.net <no...@so...> - 2008-03-08 19:34:13
|
Bugs item #1864582, was opened at 2008-01-05 18:12 Message generated for change (Comment added) made by borutr You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1864582&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: C-Front End >Group: fixed >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Martin Leopold (mleopold) >Assigned to: Borut Ražem (borutr) Summary: multiple definition of char cons w. --model-large Initial Comment: Hi All. I'm trying to compile my port of TinyOS using SDCC*, but I'm running into some problems. One problem is the following: one program runs fine with the default memory mode (small i presume), but fails with the following error when switching to large: ... ?ASxxxx-Error-<mp> in line 4627 of build/cc2430em/app.asm <m> multiple definitions error <p> phase error: label location changing between passes 2 and 3 ?ASxxxx-Error-<m> in line 4630 of build/cc2430em/app.asm <m> multiple definitions error removing build/cc2430em/app.rel ... In the example above it turns out to be a char constant that ends up being multiply defined in the asm output. I've reproduced the problem int the attached .c file. * Interested parties can take a look here: http://www.tinyos8051wg.net ---------------------------------------------------------------------- >Comment By: Borut Ražem (borutr) Date: 2008-03-08 20:34 Message: Logged In: YES user_id=568035 Originator: NO Maarten, thank you for the explanation. I red the bug report superficially, so a thought that the sizeof(sd) has to be 7. An thank you for the hint for noInit. I don't generally like such type of global variables (they can be very dangerous too), but in this case it helped to solve the bug. Fixed in svn revision #5079. Borut ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2008-03-08 14:54 Message: Logged In: YES user_id=888171 Originator: NO As already stated in bug #770484 sizeof(sd) is supposed to give 1 according to the C99 standard. There is also a regression test for it in structflexarray.c. To solve this bug I think we need something like noInit for no initializers, similar to noAlloc for no allocation. ---------------------------------------------------------------------- Comment By: Borut Ražem (borutr) Date: 2008-03-08 14:08 Message: Logged In: YES user_id=568035 Originator: NO This bug seems to be a side effect of fixing bug #770484: "sizeof() on struct containing an array is wrong" (see http://sourceforge.net/tracker/index.php?func=detail&aid=770484&group_id=599&atid=100599), which seems not to be fixed: sizeof(sd) is still 1 instead 7. The change was done in file SDCCglue.c svn revision #3333 by Maarten. Maarten, can you please re-verify if #770484 is really fixed? If it is not fixed it wold be probably better to revert the change so that bug #1864582 wouldn't appear any more. Probably a regression test should be added too... Borut ---------------------------------------------------------------------- Comment By: rlar (rlar) Date: 2008-03-05 22:11 Message: Logged In: YES user_id=1840151 Originator: NO for debugging a first suitable breakpoint might be: (gdb slang) break SDCCglue.c:263 and a helper would be (gdb slang) define print_statsg print *(symbol*)statsg->syms->item print *(symbol*)statsg->syms->next->item print *(symbol*)statsg->syms->next->next->item end ---%%--- the above mentioned break is "-1->" in : /* create a new "XINIT (CODE)" symbol, that will be emitted later in the static seg */ ... -1-> resolveIvalSym(newSym->ival, newSym->type); ... if (!SPEC_ABSA (sym->etype)) { ... -2-> printIval (sym, sym->type, sym->ival, &tmpBuf); ... after execution of the -1- funcall, print_statsg displays: {name = "_str_0" ... } Cannot access memory at address 0x0 after execution of the -2- funcall, print_statsg displays: {name = "_str_0" ... } {name = "_str_0" ... } Cannot access memory at address 0x0 and somwhere later the thing is then emited twice to the assembler output. for completness the backtrace at "-1" is: #0 emitRegularMap (map=0x8155780, addPublics=1, arFlag=1) at SDCCglue.c:263 #1 0x080c9ebb in emitMaps () at SDCCglue.c:1326 #2 0x080caaaa in glue () at SDCCglue.c:1582 #3 0x080577d1 in main (argc=4, argv=0xbfa75a74, envp=0xbfa75a88) at SDCCmain.c:2405 Robert Larice ---------------------------------------------------------------------- Comment By: rlar (rlar) Date: 2008-03-04 21:43 Message: Logged In: YES user_id=1840151 Originator: NO the submitted piece of c can be reduced to a one-liner ---->8---- char *c = (char *) "Booting"; ----<8---- compilation with (-mmcs51) sdcc -c --model-large results in a piece of *.asm with a double definition: --------- .area CONST (CODE) __str_0: .ascii "Booting" .db 0x00 __str_0: .ascii "Booting" .db 0x00 --------- the problem is bound to large-model and to the (char*) cast. Robert Larice ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=1864582&group_id=599 |