Bug 71055 - [7 Regression] FAIL: gcc.dg/torture/pr53663-1.c -Os execution test
Summary: [7 Regression] FAIL: gcc.dg/torture/pr53663-1.c -Os execution test
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: 7.0
Assignee: Richard Biener
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2016-05-10 23:52 UTC by H.J. Lu
Modified: 2017-01-04 12:36 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-05-11 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2016-05-10 23:52:25 UTC
On x86, r236066 caused

FAIL: gcc.dg/torture/pr53663-1.c   -O1  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -O2  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -O3 -g  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -Os  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -O2 -flto -fno-use-linker-plugin -flto-partit
ion=none  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -O1  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -O2  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -O3 -g  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -Os  execution test
FAIL: gcc.dg/torture/pr53663-1.c   -O2 -flto -fno-use-linker-plugin -flto-partit
ion=none  execution test

with

make check-gcc RUNTESTFLAGS="dg-torture.exp=pr53663-1.c --target_board='unix{-m32\ -fpic,-fpic}'"
Comment 1 Richard Biener 2016-05-11 08:33:51 UTC
Mine.  Even without -fpic we miscompile this - but twice, cancelling the effect.
With -fpic we miscompile it only once, namely

  v.i = 10;
  f (&v1, v);
  v.b = 0;

Deleted redundant store v.b = 0;

This is because we now figure that the read from v.b results in 0 which is
of course wrong (technically it has _Bool type and thus its precision makes
the value that GCC can use for optimization zero but it cannot use that
"precision" to say the store is redundant (because it stores still 8 bits).
Comment 2 Richard Biener 2016-05-11 09:04:45 UTC
It's a latent issue in unchanged code, not sure how it got exposed by r236066,
ah - I removed the VN_WALKREWRITE check that isn't really necessary.
Comment 3 Richard Biener 2016-05-11 14:05:03 UTC
Author: rguenth
Date: Wed May 11 14:04:32 2016
New Revision: 236122

URL: https://gcc.gnu.org/viewcvs?rev=236122&root=gcc&view=rev
Log:
2016-05-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71055
	* tree-ssa-sccvn.c (vn_reference_lookup_3): When native-interpreting
	sth with precision not equal to access size verify we don't chop
	off bits.

	* gcc.dg/torture/pr71055.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr71055.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-sccvn.c
Comment 4 Richard Biener 2016-05-11 14:05:51 UTC
Fixed.
Comment 5 Richard Biener 2017-01-04 12:36:04 UTC
Author: rguenth
Date: Wed Jan  4 12:35:32 2017
New Revision: 244053

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

	Backport from mainline
	2016-05-11  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71055
	* tree-ssa-sccvn.c (vn_reference_lookup_3): When native-interpreting
	sth with precision not equal to access size verify we don't chop
	off bits.

	* gcc.dg/torture/pr71055.c: New testcase.

Added:
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr71055.c
Modified:
    branches/gcc-6-branch/gcc/ChangeLog
    branches/gcc-6-branch/gcc/testsuite/ChangeLog
    branches/gcc-6-branch/gcc/tree-ssa-sccvn.c