#467 const char arrays initialised as 0.

closed-works-for-me
5
2013-05-25
2003-02-22
Anonymous
No

Using sdcc 2.3.2, a const array such as the following:

const unsigned char foo[10] = {1, 2, 3, 4, 5, 6, 7, 8,
9, 10 };

ends up being compiled as all zeros. The problem seems
to be the
use of BYTE_IN_LONG in printIvalType() in pic/glue.c. If
BIG_ENDIAN, then when the value size is 1, only the top
byte is
stored in the array, which is always 0. I've changed
it to use
suitably defined BYTE_IN_CHAR and BYTE_IN_SHORT for the
appropriate data types. Works For Me(TM).

Chris Emerson
sdcc@mail.nosreme.org

Discussion

  • Johan Knol

    Johan Knol - 2003-02-24
    • assigned_to: nobody --> sdattalo
     
  • Raphael Neider

    Raphael Neider - 2005-07-01
    • milestone: --> unreproducable
    • status: open --> open-works-for-me
     
  • Raphael Neider

    Raphael Neider - 2005-07-01

    Logged In: YES
    user_id=1115835

    Works with SDCC 2.5.1 #1053. I will close this in less than
    two years time if nobody disagrees ;-)

     
  • Raphael Neider

    Raphael Neider - 2005-07-21
    • status: open-works-for-me --> closed-works-for-me
     

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