aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-path.cc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2022-08-12 16:25:28 +0200
committerJan Hubicka <jh@suse.cz>2022-08-12 16:25:28 +0200
commit0f2c7ccd14a29a8af8318f50b8296098fb0ab218 (patch)
treefe93a91853ba0197baf4082b304b7e579ac0323c /gcc/gimple-range-path.cc
parent88ee126ee0401e293888e7d1b9219ad35eb130b5 (diff)
downloadgcc-0f2c7ccd14a29a8af8318f50b8296098fb0ab218.zip
gcc-0f2c7ccd14a29a8af8318f50b8296098fb0ab218.tar.gz
gcc-0f2c7ccd14a29a8af8318f50b8296098fb0ab218.tar.bz2
Fix invalid devirtualization when combining final keyword and anonymous types
this patch fixes a wrong code issue where we incorrectly devirtualize to __builtin_unreachable. The problem occurs in combination of anonymous namespaces and final keyword used on methods. We do two optimizations here 1) when reacing final method we cut the search for possible new targets 2) if the type is anonymous we detect whether it is ever instatiated by looking if its vtable is referred to. Now this goes wrong when thre is an anonymous type with final method that is not instantiated while its derived type is. So if 1 triggers we need to make 2 to look for vtables of all derived types as done by this patch. Bootstrpaped/regtested x86_64-linux Honza gcc/ChangeLog: 2022-08-10 Jan Hubicka <hubicka@ucw.cz> PR middle-end/106057 * ipa-devirt.cc (type_or_derived_type_possibly_instantiated_p): New function. (possible_polymorphic_call_targets): Use it. gcc/testsuite/ChangeLog: 2022-08-10 Jan Hubicka <hubicka@ucw.cz> PR middle-end/106057 * g++.dg/tree-ssa/pr101839.C: New test.
Diffstat (limited to 'gcc/gimple-range-path.cc')
0 files changed, 0 insertions, 0 deletions