#17 pointer initialization in ROM

None
closed-fixed
None
5
2016-05-07
2002-02-13
Corvin Zahn
No

problem with the initialization of pointers sitting in
ROM:

-----------------------------
char ch;

// Pointer in RAM: ok
char* p4 = (char*)(&ch);

// Pointer in ROM: this line results in
// tt2.c(9):warning *** Initializer different levels of
indirections
// and no code is generated
char* const p5 = (char*)(&ch);

// but this line works???
char* const p6 = &ch;
----------------------------

sdcc --version:
SDCC :
mcs51/gbz80/z80/avr/ds390/pic14/i186/tlcs900h/TININative/xa51
2.3.1 (Feb 11 2002) (UNIX)

Any hints?

Corvin

Discussion

  • Johan Knol

    Johan Knol - 2002-02-14
    • labels: 101552 -->
     
  • Johan Knol

    Johan Knol - 2002-02-14

    Logged In: YES
    user_id=63512

    Fixed in SDCCglue.c:1.107

    This isn't perfect yet. You can e.g. not do "char * code p5=
    (char code *)(&ch)" because the cast is simply ignored but
    a warning is thrown in that case, just like with "char *
    code p5=(char code *)0x1234".
    So I moved this one to the feature requests.

    Johan

     
  • Maarten Brock

    Maarten Brock - 2016-05-07
    • status: open --> closed-fixed
    • assigned_to: Maarten Brock
    • Group: -->
     
  • Maarten Brock

    Maarten Brock - 2016-05-07

    Somewhere along the lines of 14 years of development for SDCC this was fixed.

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks