#309 const struct initializer

closed-fixed
Johan Knol
5
2013-05-25
2002-03-02
No

The const struct is not initialized correctly (the s
member simply is not initialized at all).

I've compiled for z80.

SDCC generates the following warning:
t12.c:5: warning: Initializer different levels of
indirections

Follows code.
-- []s Felipe

#include <stdio.h>

char d[] = { 'a','b', 0 };

const struct { char *s; } a = { d+1 };

int main(void) {
printf("%s\n", a.s );
}

Discussion

  • Johan Knol
    Johan Knol
    2002-03-03

    Logged In: YES
    user_id=63512

    fixed in SDCCglue.c:1.113

     
  • Johan Knol
    Johan Knol
    2002-03-03

    • labels: --> C-Front End
    • milestone: --> fixed
    • assigned_to: nobody --> johanknol
    • status: open --> closed-fixed