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] New: 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

           Summary: If an array  "designated intializer" in a struct causes
                    a segv.
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eamon at sonyoxford dot co dot uk
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-slackware-linux
  GCC host triplet: i386-slackware-linux
GCC target triplet: i386-slackware-linux

The following (preprocessed) code causes a segv in 3.3 and 3.2.2

# 1 "t.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "t.c"
typedef struct smrdd_memory_blocks_s {
        int blocks;
                int block[];
        } smrdd_memory_blocks_t;

const smrdd_memory_blocks_t smrdd_memory_blocks={
        (3),
            {
                [5] = 0,
                [1] = 2,
            }
        };

It only happens with the struct, changing it too an int array is okay.

The values of the index (5 and 1) do not matter, nor do the values assigned
(0 and 2).

Thanks
Eamon.
(This is not the original code that found the problem, just the
distilled essence.)

=====================
gcc -save-temps -v -Wall t.c
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/3.3/specs
Configured with: ../gcc-3.3/configure --prefix=/usr --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld
--verbose --target=i386-slackware-linux --host=i386-slackware-linux
Thread model: posix
gcc version 3.3
 /usr/lib/gcc-lib/i386-slackware-linux/3.3/cc1 -E -quiet -v -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 t.c -Wall t.i
ignoring nonexistent directory "/usr/i386-slackware-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-slackware-linux/3.3/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-slackware-linux/3.3/cc1 -fpreprocessed t.i -quiet
-dumpbase t.c -auxbase t -Wall -version -o t.s
GNU C version 3.3 (i386-slackware-linux)
        compiled by GNU C version 3.3.
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=129115
t.c:11: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


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