Bug 60849 - [4.7 Regression] bogus comparison result type
Summary: [4.7 Regression] bogus comparison result type
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.8.3
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-15 18:09 UTC by dehao
Modified: 2014-06-12 13:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.10.0, 4.8.3, 4.9.1
Known to fail: 4.7.4, 4.8.2, 4.9.0
Last reconfirmed: 2014-04-15 00:00:00


Attachments
testcase (97 bytes, text/x-c++src)
2014-04-15 18:09 UTC, dehao
Details
patch (598 bytes, patch)
2014-04-16 13:23 UTC, Richard Biener
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description dehao 2014-04-15 18:09:31 UTC
Created attachment 32605 [details]
testcase

In execute_fold_all_builtins, the builtin is expanded to UNORDERED_EXPR, but its lhs is not updated to boolean type.

#gcc -c test.cc -O2
test.cc: In function ‘void foo(float)’:
test.cc:10:1: error: bogus comparison result type
 }
 ^
int
_7 = _4 unord _4;
test.cc:10:1: internal compiler error: verify_gimple failed
0xbadd91 verify_gimple_in_cfg(function*)
	../../gcc/tree-cfg.c:4942
0xad3d94 execute_function_todo
	../../gcc/passes.c:1853
0xad47c3 execute_todo
	../../gcc/passes.c:1887
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Paul Pluzhnikov 2014-04-15 19:10:33 UTC
Google ref: b/13715169
Comment 2 Marek Polacek 2014-04-15 19:18:58 UTC
Started with r176563.
Comment 3 Richard Biener 2014-04-16 08:35:09 UTC
I will have a look.
Comment 4 Richard Biener 2014-04-16 13:23:12 UTC
Created attachment 32616 [details]
patch
Comment 5 Richard Biener 2014-04-17 08:14:25 UTC
Author: rguenth
Date: Thu Apr 17 08:13:53 2014
New Revision: 209469

URL: http://gcc.gnu.org/viewcvs?rev=209469&root=gcc&view=rev
Log:
2014-04-17  Richard Biener  <rguenther@suse.de>

	PR middle-end/60849
	* tree-ssa-propagate.c (valid_gimple_rhs_p): Only allow effective
	boolean results for comparisons.

	* g++.dg/opt/pr60849.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr60849.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-propagate.c
Comment 6 Richard Biener 2014-04-17 08:14:38 UTC
Fixed on trunk sofar.
Comment 7 Richard Biener 2014-04-17 13:51:27 UTC
Author: rguenth
Date: Thu Apr 17 13:50:55 2014
New Revision: 209486

URL: http://gcc.gnu.org/viewcvs?rev=209486&root=gcc&view=rev
Log:
2014-04-17  Richard Biener  <rguenther@suse.de>

	PR middle-end/60849
	* tree-ssa-propagate.c (valid_gimple_rhs_p): Allow vector
	comparison results and add clarifying comment.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-ssa-propagate.c
Comment 8 dehao 2014-04-17 22:42:32 UTC
Richard,

Thanks for the quick fix. Are both patches needed? Could you backport your patches to gcc-4_9 branch?

Thanks,
Dehao
Comment 9 rguenther@suse.de 2014-04-22 07:45:05 UTC
On Thu, 17 Apr 2014, dehao at gcc dot gnu.org wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60849
> 
> --- Comment #8 from dehao at gcc dot gnu.org ---
> Richard,
> 
> Thanks for the quick fix. Are both patches needed? Could you backport your
> patches to gcc-4_9 branch?

Sure, after 4.9.0 is out.
Comment 10 Richard Biener 2014-04-22 13:32:12 UTC
Author: rguenth
Date: Tue Apr 22 13:31:41 2014
New Revision: 209632

URL: http://gcc.gnu.org/viewcvs?rev=209632&root=gcc&view=rev
Log:
2014-04-22  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2014-04-17  Richard Biener  <rguenther@suse.de>

	PR middle-end/60849
	* tree-ssa-propagate.c (valid_gimple_rhs_p): Only allow effective
	boolean results for comparisons.

	* g++.dg/opt/pr60849.C: New testcase.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/opt/pr60849.C
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-ssa-propagate.c
Comment 11 Richard Biener 2014-05-06 09:02:41 UTC
Author: rguenth
Date: Tue May  6 09:02:08 2014
New Revision: 210099

URL: http://gcc.gnu.org/viewcvs?rev=210099&root=gcc&view=rev
Log:
2014-05-06  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2014-04-17  Richard Biener  <rguenther@suse.de>

	PR middle-end/60849
	* tree-ssa-propagate.c (valid_gimple_rhs_p): Only allow effective
	boolean results for comparisons.

	* g++.dg/opt/pr60849.C: New testcase.

	2014-04-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/60766
	* tree-ssa-loop-ivopts.c (cand_value_at): Compute in an
	unsigned type.
	(may_eliminate_iv): Convert cand_value_at result to desired
	type.

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

	2014-04-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/60903
	* tree-ssa-loop-im.c (execute_sm_if_changed): Properly apply
	IRREDUCIBLE_LOOP loop flags to newly created BBs and edges.

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

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/opt/pr60849.C
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr60766.c
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/torture/pr60903.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_8-branch/gcc/tree-ssa-loop-im.c
    branches/gcc-4_8-branch/gcc/tree-ssa-loop-ivopts.c
    branches/gcc-4_8-branch/gcc/tree-ssa-propagate.c
Comment 12 Richard Biener 2014-06-12 13:39:51 UTC
Fixed for 4.8.3.