This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/11527] [3.3/3.4 Regression] If an array "designated intializer" in a struct causes a segv.


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


janis187 at us dot ibm dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at redhat dot com


------- Additional Comments From janis187 at us dot ibm dot com  2003-08-05 19:30 -------
The test case for PR 11527 starts getting an ICE with this patch:

--- gcc/gcc/ChangeLog ---

2001-01-04  Richard Henderson  <rth@redhat.com>

        * c-decl.c (finish_struct): Detect flexible array members
        used in an inappropriate context.
        * c-typeck.c (really_start_incremental_init): Special case
        constructor_max_index for zero length arrays.
        (pop_init_level): Allow initialization of flexible array
        members.  Deprecate initialization of zero length arrays.
        Don't issue missing initializer warning for flexible array
        members or zero length arrays.
        (process_init_element): Don't dereference null DECL_SIZE.
        * varasm.c (array_size_for_constructor): Return a HOST_WIDE_INT.
        Don't abort for empty constructors.  Use size_binop
        (output_constructor): Add commentary regarding zero length
        array futures.  Abort if we try to initialize an array of
        unspecified length with a non-empty constructor in the middle
        of a structure.

        * extend.texi (Zero Length): Update and clarify documentation
        on static initialization.

The test case starts getting an error message with this patch:

--- gcc/gcc/ChangeLog ---

2000-01-03  Richard Henderson  <rth@redhat.com>

        * c-decl.c (grokdeclarator): Give zero-length arrays size zero.
        Remove dead code.
        * c-typeck.c (push_init_level): Move checks for flexible array
        members and zero length arrays ...
        (pop_init_level): ... here.  Silently discard empty initializations.
        Remove dead code.
        * varasm.c (output_constructor): Update for sizeof change to
        zero-length arrays.

        * extend.texi (Zero Length): Clarify semantics.

Before that change the test case compiled cleanly.  The error message
seen between the two patches is:

11527.c:11: initialization of a flexible array member
11527.c:11: (near initialization for `smrdd_memory_blocks.block')

The regression hunt took place on i686-pc-linux-gnu using the submitter's
test case.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]