Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1286 pic14, assembly generation issue related to pagesel

closed-invalid
nobody
5
2013-05-25
2007-02-05
Simon McAuliffe
No

sdcc version: 2.6.4 #4613 (Feb 3 2007)

In some situations the compiler produces invalid intermediate assembly. This only seems to happen for some processor selections and is quite fussy about showing itself.

---sample code---
void a();
void c(char v);

static void isr() interrupt 0 {
a();
}

void b()
{
}

void main() {
a();
a();
a();
b();
c(0);
}
---end of sample---

Command to produce error:
sdcc -mpic14 -p16f648a -c test.c

For some other processors, the error does not occur (perhaps it's related to memory size?)

The cause of the error seems to be the generation of a PAGESEL $ immediately prior to a RETURN instruction, although there seems to be a little more to it than that too. For example, removing the seemingly unreleated ISR makes the error go away. It may be a gputils bug (??).

Discussion

  • Logged In: YES
    user_id=1304410
    Originator: YES

    Sorry, the actual error message is:
    test.asm:162:Error [115] Duplicate label or redefining symbol that cannot be redefined. (_$_00000d)

    Also, removing/reordering or changing pretty much any of the function calls in main() makes the error go away.

     
  • Raphael Neider
    Raphael Neider
    2007-02-05

    • milestone: --> non_bugs
    • status: open --> closed-invalid
     
  • Raphael Neider
    Raphael Neider
    2007-02-05

    Logged In: YES
    user_id=1115835
    Originator: NO

    As SDCC did not even emit a label like _$_00000d whereas gpasm generates such labels internally (gpasm/evaluate.c:436 in add_reloc()), this *is* a bug in gputils. It seems the labels are generated from the current offset in the current code section (c_interrupt resp. c_test). Unfortunately, both of two code sections require a relocation at offset 0x0d, which kills gpasm.
    Closing this but opened bug report #1652208 (https://sourceforge.net/tracker/index.php?func=detail&aid=1652208&group_id=41924&atid=431665) for gputils instead.

    Thanks for the report anyways,
    Raphael

     
  • David Barnett
    David Barnett
    2007-02-05

    Logged In: YES
    user_id=896846
    Originator: NO

    This is a bug with gpasm that I discovered and fixed in CVS several months ago. The fixed version hasn't been released yet, but I'll pass the word along to the maintainer and see when we can make a new release. I posted more details about the date and CVS repository at gpsim bug #1652208 (https://sourceforge.net/tracker/index.php?func=detail&aid=1652208&group_id=41924&atid=431665), which Raphael just created. For technical details about the bug, check for a thread called "'pagesel $' dup error" in the gnupic@linuxhacker.org mailing list.