https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125225
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ASan finds an ODR violation |gnu_unique_object is
|in piecewise_construct with |missing with LTO
|-flto=auto |
Component|sanitizer |lto
--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Without LTO we have:
[apinski@xeond2 pr]$ ~/upstream-gcc/bin/gcc -fsanitize=address -shared -o
libt.so t.cc -fPIC
[apinski@xeond2 pr]$ nm libt.so|grep _ZSt19piecewise_construct
0000000000002000 u _ZSt19piecewise_construct
```
But with we get:
```
[apinski@xeond2 pr]$ ~/upstream-gcc/bin/gcc -fsanitize=address -shared -o
libt.so t.cc -fPIC -flto
[apinski@xeond2 pr]$ nm libt.so|grep _ZSt19piecewise_construct
00000000000040c1 B __odr_asan._ZSt19piecewise_construct
0000000000002000 R _ZSt19piecewise_construct
```
Without -fsanitize=address we get:
```
[apinski@xeond2 pr]$ ~/upstream-gcc/bin/gcc -shared -o libt.so t.cc -fPIC
-flto
[apinski@xeond2 pr]$ nm libt.so|grep _ZSt19piecewise_construct
0000000000002000 R _ZSt19piecewise_construct
```
Which is wrong, gnu_unique_object is gone it seems.
This is for:
```
namespace std __attribute__((visibility("default")))
{
/// Tag type for piecewise construction of std::pair objects.
struct piecewise_construct_t { explicit piecewise_construct_t() = default; };
/// Tag for piecewise construction of std::pair objects.
inline constexpr piecewise_construct_t piecewise_construct =
piecewise_construct_t();
}
void g(auto&);
void f()
{
g(std::piecewise_construct);
}
```