https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295
Bug ID: 66295
Summary: LTO generates incorrect resolver call for function
multiversioning
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: evstupac at gmail dot com
Target Milestone: ---
g++ test.cpp -flto
./a.out; echo $?
1
#include <stdio.h>
__attribute__((target("default")))
int
foo()
{
return 1;
}
__attribute__((target("arch=core2")))
int
foo()
{
return 2;
}
int main()
{
return foo() > 2;
}
GCC with -flto generates call of "_Z3foov.resolver" in main instead of
"_Z13_Z3foov.ifuncv"
This lead to incorrect execution - no foo() version called.
Without "-flto" test works fine.