bebbo / gcc

Bebbo's gcc-6-branch for m68k-amigaos
GNU General Public License v2.0
33 stars 11 forks source link

internal compiler error with nested structs on 68020 #190

Closed reinauer closed 1 year ago

reinauer commented 1 year ago
m68k-amigaos-gcc -v
Using built-in specs.
COLLECT_GCC=m68k-amigaos-gcc
COLLECT_LTO_WRAPPER=/opt/amiga-2022.08/libexec/gcc/m68k-amigaos/6.5.0b/lto-wrapper
Target: m68k-amigaos
Configured with: /home/stepan/git/amiga-gcc/projects/gcc/configure --prefix=/opt/amiga-2022.08 --target=m68k-amigaos --enable-languages=c,c++,objc --enable-version-specific-runtime-libs --disable-libssp --disable-nls --with-headers=/home/stepan/git/amiga-gcc/projects/newlib-cygwin/newlib/libc/sys/amigaos/include/ --disable-shared --enable-threads=no --with-stage1-ldflags='-dynamic-libgcc -dynamic-libstdc++' --with-boot-ldflags='-dynamic-libgcc -dynamic-libstdc++'
Thread model: single
gcc version 6.5.0b 220929090246 (GCC) 
m68k-amigaos-gcc   -mcpu=68020 -Os -c crash.c -o crash.o
crash.c: In function 'internal_compiler_error':
crash.c:42:1: internal compiler error: Segmentation fault
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
struct a {
    struct a *a;
};

struct b;
void *do_sth_with_b(struct b *b);

struct c {
 struct b *b;
};

struct d {
 struct c *c;
};

struct e {
 struct d *d;
};

struct f {
 struct a a;
 struct e *e;
};

struct g {
 struct f *f;
};

struct h {
};

void internal_compiler_error(void *);

void internal_compiler_error(void *arg)
{
    struct g *g;
    struct e *e;
    struct h *h;
    g = arg;
    e = g->f->e;
    h = do_sth_with_b(e->d->c->b);
}
reinauer commented 1 year ago

(This is on Ubuntu 22.04.1 LTS. The same version built on MacOS seems to not crash)

bebbo commented 1 year ago

(This is on Ubuntu 22.04.1 LTS. The same version built on MacOS seems to not crash)

I can't reproduce this yet. Also valgrind does not report any error.

Could you add these parameters: -fdump-rtl-all -fdump-tree-all to determine which is the last pass that succeeds?

bebbo commented 1 year ago

fix should be live soon

reinauer commented 1 year ago

Could you add these parameters: -fdump-rtl-all -fdump-tree-all to determine which is the last pass that succeeds?

crash.tar.xz contains all the files produced

reinauer commented 1 year ago

fix should be live soon

I can confirm that this fixed the issue. Thank you!