[Bug c++/100279] New: Invalid generated assembly for NTTP lambda with negative double value
bobmiller at nvidia dot com
gcc-bugzilla@gcc.gnu.org
Tue Apr 27 01:33:32 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100279
Bug ID: 100279
Summary: Invalid generated assembly for NTTP lambda with
negative double value
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: bobmiller at nvidia dot com
Target Milestone: ---
Created attachment 50683
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50683&action=edit
The preprocessed file that triggers the bug
I've stumbled across an obscure behavior that results in incorrect assembly
generation: the same signature is generated twice, which the assembler later
(correctly) rejects. I've tested this on GCC-11 and trunk, on my own machine
and godbolt ( example here: https://godbolt.org/z/6eEnKca9o )
Minimal example:
----------------------------
template<auto V> struct T {};
template<class F> void E(F &&) {}
template<auto V, decltype(V)...Vs, class F>
void E(F &&f)
{
f(T<V>{});
E<Vs...>(f);
}
void foo()
{
E<-1.0, -2.0>(
[&]<auto X>(T<X>){});
}
int main(int, char**) {}
--------------------------
Interestingly, this does NOT occur for floats or long doubles: only doubles:
changing the suffixes of -1.0 and -2.0 above to -1.0f and -2.0f (or -1.0L and
-2.0L) results in valid generated code.
------------------
Output from gcc -v:
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/home/bob/libexec/gcc/x86_64-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../gcc/configure -v --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/home/bob/
--enable-checking=release --enable-languages=c,c++ --disable-multilib
--program-suffix=-11
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210426 (experimental) (GCC)
Command line to trigger bug: g++-11 --std=c++20 bugtest.cpp -o test
Compiler output:
/tmp/ccmrd0Wr.s: Assembler messages:
/tmp/ccmrd0Wr.s:106: Error: symbol
`_ZZ3foovENKUl1TIXT_EEE_clILdffffffff00000000EEEDaS0_' is already defined
More information about the Gcc-bugs
mailing list