[Bug tree-optimization/87022] [8/9 Regression] miscompilation with -ftree-loop-distribution
amker at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 20 05:42:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87022
--- Comment #2 from bin cheng <amker at gcc dot gnu.org> ---
(In reply to Qirun Zhang from comment #0)
> It also affects gcc-8.1 at -O3. gcc-7.3 works fine.
>
> It appears that it starts at r253679.
>
>
> $ gcc-trunk -v
> Using built-in specs.
> COLLECT_GCC=gcc-trunk
> COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-
> linux-gnu/9.0.0/lto-wrapper
> Target: x86_64-pc-linux-gnu
> Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
> --enable-languages=c,c++ --disable-werror --enable-multilib
> Thread model: posix
> gcc version 9.0.0 20180819 (experimental) [trunk revision 263651] (GCC)
>
>
>
> $ gcc-trunk abc.c ; ./a.out > ref.txt
> $ gcc-trunk -O3 abc.c ; ./a.out > a.txt
> $ diff ref.txt a.txt
> 25,49c25,49
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> < 0
> ---
> > 1
> > 1
> > 1
> > 1
> > 0
> > 0
> > 1
> > 1
> > 1
> > 1
> > 1
> > 0
> > 0
> > 1
> > 1
> > 1
> > 1
> > 1
> > 0
> > 0
> > 1
> > 1
> > 1
> > 1
> > 1
> $ gcc-7.3 -O3 abc.c ; ./a.out > a.txt
> $ diff ref.txt a.txt
> $
>
>
> $ cat abc.c
> void printf();
> char a[7];
> char b[10][7];
> short c;
> int d, e, f, g;
> int main() {
> for (; d <= 4; d++) {
> e = 0;
> for (; e <= 6; e++) {
> if (a[c])
> b[e + 3][d + 2] = 1;
> a[0] = 5;
> b[e][d + 2] = 0;
> }
> }
> for (; f < 10; f++) {
> g = 0;
> for (; g < 7; g++)
> printf("%d\n", b[f][g]);
> }
> }
Sorry for the breakage, I will investigate it.
Thanks,
bin
More information about the Gcc-bugs
mailing list