#118 Generic Pointer Init

closed-fixed
5
2013-05-25
2001-08-26
No

When a generic pointer is initialized with an absolute
address, SDCC always assigns type 0 (DSEG), regardless
of casting the address to a particular memory type.

Here's an example:

unsigned char pointer_test(void)
{
char * some_generic_pointer = (xdata char
*)0xFF04;

return *some_generic_pointer;
}

This mcs51 code is generated:

mov dptr,#(((0xFF)<<8) + 0x04)
mov b,#0x00 ;BUG:
should by 0x01
lcall __gptrget
mov r2,a
mov dpl,r2

Also, printing a warning when the user doesn't give any
memory type would be the nice thing to do, instead of
silently assuming it's a pointer to DSEG.

Discussion

  • Johan Knol

    Johan Knol - 2001-09-03
    • milestone: --> fixed
    • assigned_to: nobody --> johanknol
    • status: open --> closed-fixed
     
  • Johan Knol

    Johan Knol - 2001-09-03

    Logged In: YES
    user_id=63512

    fixed in SDCCcse.c:1.40

     
  • Johan Knol

    Johan Knol - 2001-09-17
    • status: closed-fixed --> open-fixed
     
  • Johan Knol

    Johan Knol - 2001-09-18
    • status: open-fixed --> closed-fixed
     
  • Johan Knol

    Johan Knol - 2001-09-18

    Logged In: YES
    user_id=63512

    fixed in a better way by Sandeep

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks