#1265 is union working properly????

closed-rejected
5
2013-05-25
2006-12-28
No

hi

i am using sdcc for last 5 months, but got this problem with union.

is union working properly with sdcc 2.6 and sdcc sdcc-20061129-4491 ???

i am giving some c code and the corresponding generated assembly code...... its compiled in sdcc 2.6

Discussion

  • arnab_bhaumik

    arnab_bhaumik - 2006-12-28
     
  • Maarten Brock

    Maarten Brock - 2006-12-28

    Logged In: YES
    user_id=888171
    Originator: NO

    Hi,

    There is no bug here. All three union members start at _real_data in the asm.
    Maybe you wanted something like:

    union ab
    {
    unsigned int ab_main;
    unsigned char ab_first[2];
    };

    or

    union ab
    {
    unsigned int ab_main;
    struct
    {
    unsigned char ab_first;
    unsigned char ab_second;
    } bytes;
    };

    In the latter bytes is optional for SDCC but not for all C compilers.

    Maarten

     
  • Maarten Brock

    Maarten Brock - 2006-12-28
    • milestone: --> non_bugs
    • assigned_to: nobody --> maartenbrock
    • status: open --> closed-rejected
     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks