Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1414 bitfield initialiser overflows in code memory

closed-fixed
Maarten Brock
None
5
2013-05-25
2007-12-22
Laszlo BORTEL
No

When a bitfield initialiser is greater than the maximum allowed value for a given number of bits the compiler gives "warning 158: overflow in implicit constant conversion", and the generated initialiser code restricts the value into the allocated bits.
It is OK so far.

On the other hand when the initialised structure with bit fields is not in the data, but in the code memory the value overflows into the next bit field and no warning is given.
I would expect the same behaviour in both cases, regardless of the memory space the compiler should give a warning and restrict the initialiser into the allocated bits.

The attached program illustrates both cases: initialised structure in data and code memory.

C:\>sdcc -v
SDCC : mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08 2.7.4 #4
972 (Nov 24 2007) (MINGW32)

C:\>ver

Microsoft Windows XP [Version 5.1.2600]

Discussion

  • Laszlo BORTEL
    Laszlo BORTEL
    2007-12-22

     
    Attachments
  • Maarten Brock
    Maarten Brock
    2008-04-23

    Logged In: YES
    user_id=888171
    Originator: NO

    Fixed in SDCC 2.8.1 #5144.

     
  • Maarten Brock
    Maarten Brock
    2008-04-23

    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> closed-fixed