#18 fix for bug 770484

closed-fixed
nobody
None
5
2004-05-31
2004-05-13
No

Hello all,

When allocating space for struct variables ending in an
array of unspecified length, SDCC allocates memory as if
the length was specified as zero. This generates
truncated initializers and warnings (xdata/code) or
initialization code overwriting other variables
(data/idata). These patched files fix this bug.

Have fun,
Maarten

Discussion

  • Maarten Brock

    Maarten Brock - 2004-05-15

    Logged In: YES
    user_id=888171

    Previous patch was generating other problems. Therefor a
    new patch.

     
  • Maarten Brock

    Maarten Brock - 2004-05-15

    patched and untabified SDCCglue.c and SDCCsymt.c/.h

     
    Attachments
  • Erik Petrich

    Erik Petrich - 2004-05-16

    Logged In: YES
    user_id=635249

    SDCC's initializer code looks rather scary to me; it is hard
    to be certain that fixing one thing doesn't break another.

    Here is an alternate getAllocSize() function. It improves
    the size calculation with respect to bitfields and unions.
    Don't forget about them in your test cases.

    Erik

     
  • Erik Petrich

    Erik Petrich - 2004-05-16

    an alternate getAllocSize() function

     
    Attachments
  • Maarten Brock

    Maarten Brock - 2004-05-16

    Logged In: YES
    user_id=888171

    Erik,

    Looks like a good improvement. It never occurred to me that
    IS_STRUCT could actually mean "is struct or union". The local
    variable size isn't even needed any more.

    Greets,
    Maarten

     
  • Maarten Brock

    Maarten Brock - 2004-05-31
    • status: open --> closed-fixed
     

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

Sign up for the SourceForge newsletter:





No, thanks