An initializer for a C struct with a variable sized last component is accepted,
but the data generated excludes the variable sized component.

struct s {
   int16_t a,b,c,d;
   int16_t y[];
} data = {0,0,0,0, {2,3,4,5}};

results in only the leading four int16_t values in the data segment.

Either the initializer data should be emitted, or the initializer should be
rejected with an error, or the struct declaration should be rejected with an
error, and presumably the first option would be preferable.


-- 
           Summary: Truncated C struct data initializer with variable size
                    trailing array
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: howard dot thomson at dial dot pipex dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36987

Reply via email to