https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83944

            Bug ID: 83944
           Summary: internal compiler error: Segmentation fault with -O
                    -ftree-pre
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matt.sexton at redlinetrading dot com
  Target Milestone: ---

This bug has been observed with MinGW-w64 on Fedora 27 (gcc 7.2.0).  It is not
observed with a native Linux compile on Fedora 27 (gcc 7.2.1).

$ cat bug.c
typedef enum { a } b;
typedef struct { b action } c;
d;
inline e(void *p1) {
  long *f = p1;
  long g = f[g] = d;
}
typedef struct { int h } i;
__thread i j;
k() {
  int *l = &j.h;
  c *entryp = l;
  int m = &entryp[m];
  for (;;) {
    e(&entryp[m]);
    entryp[m].action = a;
  }
}

$ x86_64-w64-mingw32-gcc -c -O -ftree-pre bug.c
bug.c:2:27: warning: no semicolon at end of struct or union
 typedef struct { b action } c;
                           ^
bug.c:3:1: warning: data definition has no type or storage class
 d;
 ^
bug.c:3:1: warning: type defaults to 'int' in declaration of 'd'
[-Wimplicit-int]
bug.c:4:8: warning: return type defaults to 'int' [-Wimplicit-int]
 inline e(void *p1) {
        ^
bug.c:8:24: warning: no semicolon at end of struct or union
 typedef struct { int h } i;
                        ^
bug.c:10:1: warning: return type defaults to 'int' [-Wimplicit-int]
 k() {
 ^
bug.c: In function 'k':
bug.c:12:15: warning: initialization from incompatible pointer type
[-Wincompatible-pointer-types]
   c *entryp = l;
               ^
bug.c:13:11: warning: initialization makes integer from pointer without a cast
[-Wint-conversion]
   int m = &entryp[m];
           ^
bug.c:10:1: internal compiler error: Segmentation fault
 k() {
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-w64-mingw32/7.2.0/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin
--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info
--datadir=/usr/share --build=x86_64-redhat-linux-gnu
--host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose
--without-newlib --disable-multilib --disable-plugin --with-system-zlib
--disable-nls --without-included-gettext --disable-win32-registry
--enable-languages=c,c++,objc,obj-c++,fortran
--with-bugurl=http://bugzilla.redhat.com/bugzilla --with-cloog
--enable-threads=posix --enable-libgomp --target=x86_64-w64-mingw32
--with-sysroot=/usr/x86_64-w64-mingw32/sys-root
--with-gxx-include-dir=/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++
Thread model: posix
gcc version 7.2.0 20170814 (Fedora MinGW 7.2.0-1.fc27) (GCC) 

$ rpm -qf `which x86_64-w64-mingw32-gcc`
mingw64-gcc-7.2.0-1.fc27.x86_64

$ uname -a
Linux build-fedora27 4.14.6-300.fc27.x86_64 #1 SMP Thu Dec 14 15:31:24 UTC 2017
x86_64 x86_64 x86_64 GNU/Linux

Reply via email to