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

#18 fix for bug 770484

closed-fixed
nobody
None
5
2004-05-31
2004-05-13
Maarten Brock
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