* [Bug c++/95158] [10/11 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
@ 2020-05-18 5:55 ` rguenth at gcc dot gnu.org
2020-05-26 21:44 ` jason at gcc dot gnu.org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-18 5:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |9.3.0
Keywords| |wrong-code
Target Milestone|--- |10.2
Summary|Templates + Diamond |[10/11 Regression]
|Inheritance + Final = Pure |Templates + Diamond
|Virtual Function Call |Inheritance + Final = Pure
| |Virtual Function Call
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [10/11 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
2020-05-18 5:55 ` [Bug c++/95158] [10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-05-26 21:44 ` jason at gcc dot gnu.org
2020-05-26 21:52 ` jason at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2020-05-26 21:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-05-26
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
CC| |jason at gcc dot gnu.org
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [10/11 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
2020-05-18 5:55 ` [Bug c++/95158] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-05-26 21:44 ` jason at gcc dot gnu.org
@ 2020-05-26 21:52 ` jason at gcc dot gnu.org
2020-05-26 21:54 ` jason at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2020-05-26 21:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paolo.carlini at oracle dot com
Status|ASSIGNED |NEW
Assignee|jason at gcc dot gnu.org |unassigned at gcc dot gnu.org
Depends on| |67184
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Much like PR 90909, this was introduced by Paolo's patch for PR 67184 in
r10-1665-g26f8363d85fd386430ddb612a2e70624715c2ac3
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67184
[Bug 67184] Missed optimization with C++11 final specifier
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [10/11 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (2 preceding siblings ...)
2020-05-26 21:52 ` jason at gcc dot gnu.org
@ 2020-05-26 21:54 ` jason at gcc dot gnu.org
2020-06-02 17:07 ` paolo.carlini at oracle dot com
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2020-05-26 21:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [10/11 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (3 preceding siblings ...)
2020-05-26 21:54 ` jason at gcc dot gnu.org
@ 2020-06-02 17:07 ` paolo.carlini at oracle dot com
2020-06-03 21:33 ` jason at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2020-06-02 17:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
That the issue goes away when templates are not involved seems an useful hint:
are we trying to optimize too early?
Sorry, for the time being I don't feel like assigning the bug to me, I'm in the
middle of too many other things...
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [10/11 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (4 preceding siblings ...)
2020-06-02 17:07 ` paolo.carlini at oracle dot com
@ 2020-06-03 21:33 ` jason at gcc dot gnu.org
2020-06-04 19:11 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2020-06-03 21:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [10/11 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (5 preceding siblings ...)
2020-06-03 21:33 ` jason at gcc dot gnu.org
@ 2020-06-04 19:11 ` cvs-commit at gcc dot gnu.org
2020-06-04 19:13 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-04 19:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:0ddb93ce77374004c49cdfbd748ba35867620cf1
commit r11-954-g0ddb93ce77374004c49cdfbd748ba35867620cf1
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 3 23:50:06 2020 -0400
c++: Fix FE devirt with diamond inheritance [PR95158]
This started breaking in GCC 8 because of the fix for PR15272; after that
change, we (correctly) remember the lookup from template parsing time that
found Base::foo through the non-dependent MiddleB base, and so we overlook
the overrider in MiddleA. But given that, the devirtualization condition
from the fix for PR59031 is insufficient; we know that d has to be a
Derived, and we found Base::foo in Base, but forcing a non-virtual call
gets the wrong function.
Fixed by removing the PR59031 code that the PR67184 patch moved to
build_over_call, and instead looking up the overrider in BINFO_VIRTUALS.
gcc/cp/ChangeLog:
PR c++/95158
* class.c (lookup_vfn_in_binfo): New.
* call.c (build_over_call): Use it.
* cp-tree.h (resolves_to_fixed_type_p): Add default argument.
(lookup_vfn_in_binfo): Declare.
gcc/testsuite/ChangeLog:
PR c++/95158
* g++.dg/template/virtual5.C: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [10/11 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (6 preceding siblings ...)
2020-06-04 19:11 ` cvs-commit at gcc dot gnu.org
@ 2020-06-04 19:13 ` cvs-commit at gcc dot gnu.org
2020-06-04 19:16 ` [Bug c++/95158] [8/9 " jason at gcc dot gnu.org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-04 19:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:e244b0acf3111c95bb1559e7610f84740b90589f
commit r10-8242-ge244b0acf3111c95bb1559e7610f84740b90589f
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 3 23:50:06 2020 -0400
c++: Fix FE devirt with diamond inheritance [PR95158]
This started breaking in GCC 8 because of the fix for PR15272; after that
change, we (correctly) remember the lookup from template parsing time that
found Base::foo through the non-dependent MiddleB base, and so we overlook
the overrider in MiddleA. But given that, the devirtualization condition
from the fix for PR59031 is insufficient; we know that d has to be a
Derived, and we found Base::foo in Base, but forcing a non-virtual call
gets the wrong function.
Fixed by removing the PR59031 code that the PR67184 patch moved to
build_over_call, and instead looking up the overrider in BINFO_VIRTUALS.
gcc/cp/ChangeLog:
PR c++/95158
* class.c (lookup_vfn_in_binfo): New.
* call.c (build_over_call): Use it.
* cp-tree.h (resolves_to_fixed_type_p): Add default argument.
(lookup_vfn_in_binfo): Declare.
gcc/testsuite/ChangeLog:
PR c++/95158
* g++.dg/template/virtual5.C: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [8/9 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (7 preceding siblings ...)
2020-06-04 19:13 ` cvs-commit at gcc dot gnu.org
@ 2020-06-04 19:16 ` jason at gcc dot gnu.org
2020-11-24 17:57 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2020-06-04 19:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[10/11 Regression] |[8/9 Regression] Templates
|Templates + Diamond |+ Diamond Inheritance +
|Inheritance + Final = Pure |Final = Pure Virtual
|Virtual Function Call |Function Call
Target Milestone|10.2 |8.5
Known to work|9.3.0 |
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
If I change bar to call foo on a local Derived variable instead of 'this', it
breaks back to GCC 8. Fixed so far for 10.2/11.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [8/9 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (8 preceding siblings ...)
2020-06-04 19:16 ` [Bug c++/95158] [8/9 " jason at gcc dot gnu.org
@ 2020-11-24 17:57 ` cvs-commit at gcc dot gnu.org
2020-11-24 17:58 ` cvs-commit at gcc dot gnu.org
2020-11-24 17:58 ` jason at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-24 17:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:a2bdff4f24d9065791e6d8820004772b9fe0c4c1
commit r8-10637-ga2bdff4f24d9065791e6d8820004772b9fe0c4c1
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 3 23:50:06 2020 -0400
c++: Fix FE devirt with diamond inheritance [PR95158]
This started breaking in GCC 8 because of the fix for PR15272; after that
change, we (correctly) remember the lookup from template parsing time that
found Base::foo through the non-dependent MiddleB base, and so we overlook
the overrider in MiddleA. But given that, the devirtualization condition
from the fix for PR59031 is insufficient; we know that d has to be a
Derived, and we found Base::foo in Base, but forcing a non-virtual call
gets the wrong function.
Fixed by removing the PR59031 code, and instead looking up the overrider in
BINFO_VIRTUALS.
gcc/cp/ChangeLog:
PR c++/95158
* class.c (lookup_vfn_in_binfo): New.
* call.c (build_over_call): Use it.
(build_new_method_call_1): Don't set LOOKUP_NONVIRTUAL.
* cp-tree.h (resolves_to_fixed_type_p): Add default argument.
(lookup_vfn_in_binfo): Declare.
gcc/testsuite/ChangeLog:
PR c++/95158
* g++.dg/template/virtual5.C: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [8/9 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (9 preceding siblings ...)
2020-11-24 17:57 ` cvs-commit at gcc dot gnu.org
@ 2020-11-24 17:58 ` cvs-commit at gcc dot gnu.org
2020-11-24 17:58 ` jason at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-24 17:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:19323ea3e9344eb773f8fe872eadbe4f1ac6461f
commit r9-9066-g19323ea3e9344eb773f8fe872eadbe4f1ac6461f
Author: Jason Merrill <jason@redhat.com>
Date: Wed Jun 3 23:50:06 2020 -0400
c++: Fix FE devirt with diamond inheritance [PR95158]
This started breaking in GCC 8 because of the fix for PR15272; after that
change, we (correctly) remember the lookup from template parsing time that
found Base::foo through the non-dependent MiddleB base, and so we overlook
the overrider in MiddleA. But given that, the devirtualization condition
from the fix for PR59031 is insufficient; we know that d has to be a
Derived, and we found Base::foo in Base, but forcing a non-virtual call
gets the wrong function.
Fixed by removing the PR59031 code, and instead looking up the overrider in
BINFO_VIRTUALS.
gcc/cp/ChangeLog:
PR c++/95158
* class.c (lookup_vfn_in_binfo): New.
* call.c (build_over_call): Use it.
(build_new_method_call_1): Don't set LOOKUP_NONVIRTUAL.
* cp-tree.h (resolves_to_fixed_type_p): Add default argument.
(lookup_vfn_in_binfo): Declare.
gcc/testsuite/ChangeLog:
PR c++/95158
* g++.dg/template/virtual5.C: New test.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c++/95158] [8/9 Regression] Templates + Diamond Inheritance + Final = Pure Virtual Function Call
2020-05-15 22:59 [Bug c++/95158] New: Templates + Diamond Inheritance + Final = Pure Virtual Function Call sudgylacmoe at gmail dot com
` (10 preceding siblings ...)
2020-11-24 17:58 ` cvs-commit at gcc dot gnu.org
@ 2020-11-24 17:58 ` jason at gcc dot gnu.org
11 siblings, 0 replies; 13+ messages in thread
From: jason at gcc dot gnu.org @ 2020-11-24 17:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Also fixed for 8.5/9.4.
^ permalink raw reply [flat|nested] 13+ messages in thread