Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2057 Non-literal pointer expression treated as literal

closed-fixed
Erik Petrich
7
2013-05-25
2012-07-02
Anonymous
No

This function:

void f(int x, int y) {
unsigned short *p = (unsigned short *)(((unsigned char *)(0x9340)) + x * 12 + y / 8);
g(p);
}

when compiled, always passes the literal value 0x9340 into g, no matter what x and y are. A full program is in main.c.

Command:
sdcc -mz80 -L sdcc/lib/z80 main.c

Version:
3.2.0 #8004 (Jul 1 2012) (Mac OS X i386)

Discussion


  • Anonymous
    2012-07-02

     
    Attachments
    • priority: 5 --> 7
    • labels: 100692 -->
     
  • 1) This is not a z80-specific bug. It occurs for all ports.

    2) The bug occurs for g that takes an unsigned short*, too; i.e. the issue is probably not a wrong conversion to void*.

    3) Increasing priority, since bad code is generated silently.

    Philipp

     
  • Erik Petrich
    Erik Petrich
    2012-09-10

    • milestone: --> fixed
    • assigned_to: nobody --> epetrich
    • labels: --> C-Front End
    • status: open --> closed-fixed
     
  • Erik Petrich
    Erik Petrich
    2012-09-10

    Fixed in revision #8096