#2040 pointer math gives code generator internal error

closed-duplicate
5
2013-05-25
2012-06-08
syd
No

1. Code:
int main()
{
int a;
volatile char b = 4;
int *p = &a + b;
//int *p = &a + (int) b; no error after type conversion to int
return *p;
}

2. sdcc test04.c
3. SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08 3.1.5 #7875 (Jun 8 2012) (MINGW32)
4. error 9: FATAL Compiler Internal Error in file '/home/sdcc-builder/build/sdcc-build/orig/sdcc/src/mcs51/gen.c' line number '8963' : code generator internal error

Discussion

  • syd

    syd - 2012-06-08

    src

     
    Attachments
  • David Grayson

    David Grayson - 2012-06-08

    I have encountered this bug too, using the Linux version of the Jun 8 2012 build. Code:

    volatile struct { unsigned long a; } e[2];
    unsigned char i = 0;
    void f() { (e+i)->a; }

    Workaround #1: (e+(int)i)->a;
    Workaround #2: (&e[i])->a;
    Workaround #3: Change struct so its size is not a multiple of 4

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-08-22

    It looks like this bug got fixed in SDCC : mcs51/gbz80/z80/z180/r2k/r3ka/ds390/pic16/pic14/TININative/ds400/hc08/s08
    3.2.0 #8008 (Jul 6 2012) (MINGW32). So maybe someone on the SDCC team should verify that and mark this as closed.

     
  • Maarten Brock

    Maarten Brock - 2012-08-23

    Yes, this was duplicated by 3537338 which was worked around for the 3.2.0 release and fixed in SDCC 3.2.1 #8049. Sorry for not noticing the duplication.

     
  • Maarten Brock

    Maarten Brock - 2012-08-23
    • labels: --> mcs51(8051) target
    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> open-duplicate
     
  • Maarten Brock

    Maarten Brock - 2012-08-23
    • status: open-duplicate --> closed-duplicate
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks