Bug 61085 - [4.9/4.10 Regression] wrong code with -O2 -fno-early-inlining (maybe wrong devirtualization)
Summary: [4.9/4.10 Regression] wrong code with -O2 -fno-early-inlining (maybe wrong de...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ipa (show other bugs)
Version: 5.0
: P2 normal
Target Milestone: 4.9.1
Assignee: Martin Jambor
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2014-05-06 19:48 UTC by Zdenek Sojka
Modified: 2014-07-23 06:23 UTC (History)
3 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work: 4.7.4, 4.8.3
Known to fail: 4.10.0, 4.9.1
Last reconfirmed: 2014-05-07 00:00:00


Attachments
reduced testcase (170 bytes, text/x-csrc)
2014-05-06 19:48 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2014-05-06 19:48:13 UTC
Created attachment 32748 [details]
reduced testcase

Output:
$ g++ -O2 -fno-early-inlining testcase.C
$ ./a.out 
Aborted

$ g++ -O2 -fno-early-inlining testcase.C -fno-devirtualize
$ ./a.out
(no output)

Tested revisions:
r210047 - fail
4.9 r209651 - fail
4.8 r209342 - OK
4.7 r209345 - OK
Comment 1 Richard Biener 2014-05-07 08:31:15 UTC
Confirmed.
Comment 2 Jakub Jelinek 2014-05-12 09:12:28 UTC
Started with r202036.
Comment 3 Martin Jambor 2014-05-14 16:34:16 UTC
Mine
Comment 4 Martin Jambor 2014-05-15 14:46:19 UTC
I have proposed a fix on the mailing list:

https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01199.html
Comment 5 Martin Jambor 2014-05-15 15:04:49 UTC
Author: jamborm
Date: Thu May 15 15:04:18 2014
New Revision: 210477

URL: http://gcc.gnu.org/viewcvs?rev=210477&root=gcc&view=rev
Log:
2014-05-15  Martin Jambor  <mjambor@suse.cz>

	PR ipa/61085
	* ipa-prop.c (update_indirect_edges_after_inlining): Check
	type_preserved flag when the indirect edge is polymorphic.

testsuite/
	* g++.dg/ipa/pr61085.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/ipa/pr61085.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-prop.c
    trunk/gcc/testsuite/ChangeLog
Comment 6 Martin Jambor 2014-05-15 15:11:29 UTC
Author: jamborm
Date: Thu May 15 15:10:58 2014
New Revision: 210478

URL: http://gcc.gnu.org/viewcvs?rev=210478&root=gcc&view=rev
Log:
2014-05-15  Martin Jambor  <mjambor@suse.cz>

	PR ipa/61085
	* ipa-prop.c (update_indirect_edges_after_inlining): Check
	type_preserved flag when the indirect edge is polymorphic.

testsuite/
	* g++.dg/ipa/pr61085.C: New test.


Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/pr61085.C
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/ipa-prop.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Comment 7 Martin Jambor 2014-05-15 15:18:09 UTC
Fixed.
Comment 8 Zdenek Sojka 2014-07-16 19:23:38 UTC
The testcase fails at -Os @ r212580:
$ g++ -Os pr61085.ii
$ ./a.out 
Aborted
Comment 9 Richard Biener 2014-07-17 08:08:35 UTC
Can you open a new bug for that?
Comment 10 Zdenek Sojka 2014-07-23 06:23:55 UTC
(In reply to Richard Biener from comment #9)
> Can you open a new bug for that?

Opened PR61884 for that.