public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context
@ 2014-08-05 1:35 oremanj at mit dot edu
2014-08-05 9:04 ` [Bug ipa/62015] [4.8/4.9/4.10 Regression] " rguenth at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: oremanj at mit dot edu @ 2014-08-05 1:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
Bug ID: 62015
Summary: ipa-cp-clone uses a clone that is too specialized for
the call context
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: oremanj at mit dot edu
In the C++ program below, interprocedural constant propagation cloning creates
a clone of A::adjust() specialized for adjust(Side::Invalid, false). This clone
is then used for an adjust(side, false) call when there is no way to prove side
== Side::Invalid. This bug is present in gcc 4.8.2, is not present in 4.7.3,
and is still present in a version compiled from today's SVN. Using an
optimization level less than -O3 or passing -fno-ipa-cp-clone prevents the bug
from manifesting. The onset of the bug was bisected to commit r193410.
$ cat t.cc
extern "C" int printf(const char *fmt, ...);
struct Side {
enum _Value { Left, Right, Invalid };
constexpr Side() : _value(Invalid) {}
constexpr Side(_Value value) : _value(value) {}
operator _Value() const { return (_Value)_value; }
private:
char _value;
};
struct A {
void init();
void adjust(Side side, bool final);
void move(Side side);
};
void A::init()
{
adjust(Side::Invalid, false);
}
__attribute__((noinline))
void A::adjust(Side side, bool final)
{
printf("adjust: side is %d, final %d\n", (int)side, final);
}
void A::move(Side side)
{
printf("move: side is %d\n", (int)side);
adjust(side, false);
adjust(side, true);
}
int main()
{
A t;
t.move(Side::Left);
}
$ g++49 -v
Using built-in specs.
COLLECT_GCC=g++49
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc49/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local --disable-nls
--libdir=/usr/local/lib/gcc49 --libexecdir=/usr/local/libexec/gcc49
--program-suffix=49 --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc49/include/c++/
--with-libiconv-prefix=/usr/local --with-system-zlib --disable-rpath
--enable-languages=c,c++ --mandir=/usr/local/man
--infodir=/usr/local/info/gcc49 --disable-initfini-array
--disable-install-libiberty
Thread model: posix
gcc version 4.10.0 20140804 (experimental) (GCC)
$ g++49 -Wall -Wextra -o t t.cc -std=c++11 -O3
$ ./t
move: side is 0
adjust: side is 2, final 0
adjust: side is 0, final 1
The output should be 'side is 0' on all three lines.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/62015] [4.8/4.9/4.10 Regression] ipa-cp-clone uses a clone that is too specialized for the call context
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
@ 2014-08-05 9:04 ` rguenth at gcc dot gnu.org
2014-08-30 13:18 ` [Bug ipa/62015] [4.8/4.9/5 " mikpelinux at gmail dot com
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-08-05 9:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
CC| |jamborm at gcc dot gnu.org
Known to work| |4.7.2
Target Milestone|--- |4.8.4
Summary|ipa-cp-clone uses a clone |[4.8/4.9/4.10 Regression]
|that is too specialized for |ipa-cp-clone uses a clone
|the call context |that is too specialized for
| |the call context
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/62015] [4.8/4.9/5 Regression] ipa-cp-clone uses a clone that is too specialized for the call context
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
2014-08-05 9:04 ` [Bug ipa/62015] [4.8/4.9/4.10 Regression] " rguenth at gcc dot gnu.org
@ 2014-08-30 13:18 ` mikpelinux at gmail dot com
2014-09-02 16:38 ` jamborm at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mikpelinux at gmail dot com @ 2014-08-30 13:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
Mikael Pettersson <mikpelinux at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpelinux at gmail dot com
--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
I can reproduce this wrong-code on x86_64-linux with gcc 5-20140824,
4.9-20140827, and 4.8-20140828. 4.7-20140607 works.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/62015] [4.8/4.9/5 Regression] ipa-cp-clone uses a clone that is too specialized for the call context
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
2014-08-05 9:04 ` [Bug ipa/62015] [4.8/4.9/4.10 Regression] " rguenth at gcc dot gnu.org
2014-08-30 13:18 ` [Bug ipa/62015] [4.8/4.9/5 " mikpelinux at gmail dot com
@ 2014-09-02 16:38 ` jamborm at gcc dot gnu.org
2014-09-03 8:50 ` jamborm at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-09-02 16:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-09-02
Assignee|unassigned at gcc dot gnu.org |jamborm at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Mine
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/62015] [4.8/4.9/5 Regression] ipa-cp-clone uses a clone that is too specialized for the call context
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
` (2 preceding siblings ...)
2014-09-02 16:38 ` jamborm at gcc dot gnu.org
@ 2014-09-03 8:50 ` jamborm at gcc dot gnu.org
2014-09-03 14:27 ` jamborm at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-09-03 8:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
I have proposed a fix on the mailing list:
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00210.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/62015] [4.8/4.9/5 Regression] ipa-cp-clone uses a clone that is too specialized for the call context
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
` (3 preceding siblings ...)
2014-09-03 8:50 ` jamborm at gcc dot gnu.org
@ 2014-09-03 14:27 ` jamborm at gcc dot gnu.org
2014-09-03 16:17 ` jamborm at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-09-03 14:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
--- Comment #4 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Author: jamborm
Date: Wed Sep 3 14:26:38 2014
New Revision: 214878
URL: https://gcc.gnu.org/viewcvs?rev=214878&root=gcc&view=rev
Log:
2014-09-03 Martin Jambor <mjambor@suse.cz>
PR ipa/62015
* ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible
pass-trough jump functions correctly.
testsuite/
* g++.dg/ipa/pr62015.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/ipa/pr62015.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-cp.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/62015] [4.8/4.9/5 Regression] ipa-cp-clone uses a clone that is too specialized for the call context
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
` (4 preceding siblings ...)
2014-09-03 14:27 ` jamborm at gcc dot gnu.org
@ 2014-09-03 16:17 ` jamborm at gcc dot gnu.org
2014-09-03 16:36 ` jamborm at gcc dot gnu.org
2014-09-03 16:38 ` jamborm at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-09-03 16:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Author: jamborm
Date: Wed Sep 3 16:16:28 2014
New Revision: 214883
URL: https://gcc.gnu.org/viewcvs?rev=214883&root=gcc&view=rev
Log:
2014-09-03 Martin Jambor <mjambor@suse.cz>
PR ipa/62015
* ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible
pass-trough jump functions correctly.
testsuite/
* g++.dg/ipa/pr62015.C: New test.
Added:
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/pr62015.C
Modified:
branches/gcc-4_9-branch/gcc/ChangeLog
branches/gcc-4_9-branch/gcc/ipa-cp.c
branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/62015] [4.8/4.9/5 Regression] ipa-cp-clone uses a clone that is too specialized for the call context
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
` (5 preceding siblings ...)
2014-09-03 16:17 ` jamborm at gcc dot gnu.org
@ 2014-09-03 16:36 ` jamborm at gcc dot gnu.org
2014-09-03 16:38 ` jamborm at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-09-03 16:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Author: jamborm
Date: Wed Sep 3 16:36:06 2014
New Revision: 214885
URL: https://gcc.gnu.org/viewcvs?rev=214885&root=gcc&view=rev
Log:
2014-09-03 Martin Jambor <mjambor@suse.cz>
PR ipa/62015
* ipa-cp.c (intersect_aggregates_with_edge): Handle impermissible
pass-trough jump functions correctly.
testsuite/
* g++.dg/ipa/pr62015.C: New test.
Added:
branches/gcc-4_8-branch/gcc/testsuite/g++.dg/ipa/pr62015.C
Modified:
branches/gcc-4_8-branch/gcc/ChangeLog
branches/gcc-4_8-branch/gcc/ipa-cp.c
branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug ipa/62015] [4.8/4.9/5 Regression] ipa-cp-clone uses a clone that is too specialized for the call context
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
` (6 preceding siblings ...)
2014-09-03 16:36 ` jamborm at gcc dot gnu.org
@ 2014-09-03 16:38 ` jamborm at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-09-03 16:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62015
Martin Jambor <jamborm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-03 16:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05 1:35 [Bug ipa/62015] New: ipa-cp-clone uses a clone that is too specialized for the call context oremanj at mit dot edu
2014-08-05 9:04 ` [Bug ipa/62015] [4.8/4.9/4.10 Regression] " rguenth at gcc dot gnu.org
2014-08-30 13:18 ` [Bug ipa/62015] [4.8/4.9/5 " mikpelinux at gmail dot com
2014-09-02 16:38 ` jamborm at gcc dot gnu.org
2014-09-03 8:50 ` jamborm at gcc dot gnu.org
2014-09-03 14:27 ` jamborm at gcc dot gnu.org
2014-09-03 16:17 ` jamborm at gcc dot gnu.org
2014-09-03 16:36 ` jamborm at gcc dot gnu.org
2014-09-03 16:38 ` jamborm at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).