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

            Bug ID: 93041
           Summary: GCC 10.0 with '-Os', '-O2' and '-O3' compiled program
                    crashes when it shouldn't
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msl0000023508 at gmail dot com
  Target Milestone: ---

$ cat preprocessed.c
int g1 = 2;
int *g2 = &g1;
int g3 = 6;

void func1(int **p) {
label1:
        if(p) goto label1;
        g3 = **p;
}

int main() {
        func1(&g2);
        return g3;
}
$ gcc-10.0-20191222-r279709 -v
Using built-in specs.
COLLECT_GCC=gcc-10.0-20191222-r279709
COLLECT_LTO_WRAPPER=/opt/gcc-10.0-20191222-r279709/bin/../lib/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-10-current/configure --prefix=/usr/local
--sysconfdir=/etc --localstatedir=/var --libexecdir='/usr/local/lib'
--enable-version-specific-runtime-libs --disable-rpath --with-system-zlib
--enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,fortran,lto
--enable-plugin --enable-initfini-array --enable-gnu-indirect-function
--program-suffix=-10.0-20191222-r279709
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.0 20191222 (experimental) (GCC) 
$ gcc-10.0-20191222-r279709 -Wall -Os preprocessed.c
$ ./a.out 
Segmentation fault

Reply via email to