$ cat test.c
struct R
{
        char c;
}

struct R
{
        struct R r;
}

int main(void)
{
        struct R r;

        return 0;
}

$ gcc test.c
test.c:7: error: redefinition of ‘struct R’
test.c:11: error: two or more data types in declaration specifiers
test.c:11: error: two or more data types in declaration specifiers
test.c: In function ‘main’:
test.c:15: error: incompatible types in return
test.c:12: warning: return type of ‘main’ is not ‘int’
gcc: Internal error: Segmentation fault (program cc1)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions, see
<URL:file:///usr/share/doc/gcc-4.2/README.Bugs>.

$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr
--enable-targets=all --enable-checking=release --build=i486-linux-gnu
--host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix

$ cat test.i
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.c"
struct R
{
        char c;
}

struct R
{
        struct R r;
}

int main(void)
{
        struct R r;

        return 0;
}


-- 
           Summary: SEG fault on redefinition of struct error
           Product: gcc
           Version: 4.2.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tor_rustad at hotmail dot com
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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

Reply via email to