Bug 83668 - [8 Regression] wrong code with -O -fno-tree-dominator-opts -fgraphite-identity
Summary: [8 Regression] wrong code with -O -fno-tree-dominator-opts -fgraphite-identity
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 8.0
: P4 normal
Target Milestone: 8.0
Assignee: Richard Biener
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2018-01-03 12:31 UTC by Zdenek Sojka
Modified: 2018-01-09 14:14 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail: 8.0
Last reconfirmed: 2018-01-04 00:00:00


Attachments
reduced testcase (187 bytes, text/plain)
2018-01-03 12:31 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2018-01-03 12:31:03 UTC
Created attachment 43015 [details]
reduced testcase

I have encountered several miscompilations with graphite, the minimum set of flags seems to be the one reported in this PR. -fno-tree-dominator-opts seems to be always present in the flags.

Output:
$ x86_64-pc-linux-gnu-gcc -O -fno-tree-dominator-opts -fgraphite-identity testcase.c
$ ./a.out 
Aborted

Here, a == 0.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-256069-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --disable-bootstrap --with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld --with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-256069-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
gcc version 8.0.0 20180102 (experimental) (GCC)
Comment 1 Martin Liška 2018-01-04 09:05:42 UTC
Confirmed, started with Richi's r255579.
Comment 2 Richard Biener 2018-01-05 12:47:39 UTC
Mine.
Comment 3 Richard Biener 2018-01-09 13:36:14 UTC
Author: rguenth
Date: Tue Jan  9 13:35:43 2018
New Revision: 256381

URL: https://gcc.gnu.org/viewcvs?rev=256381&root=gcc&view=rev
Log:
2018-01-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/83668
	* graphite.c (canonicalize_loop_closed_ssa): Add edge argument,
	move prologue...
	(canonicalize_loop_form): ... here, renamed from ...
	(canonicalize_loop_closed_ssa_form): ... this and amended to
	swap successor edges for loop exit blocks to make us use
	the RPO order we need for initial schedule generation.

	* gcc.dg/graphite/pr83668.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/graphite/pr83668.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/graphite.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Richard Biener 2018-01-09 14:14:35 UTC
Fixed.