From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 041A5384601D; Tue, 27 Apr 2021 01:33:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 041A5384601D From: "bobmiller at nvidia dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100279] New: Invalid generated assembly for NTTP lambda with negative double value Date: Tue, 27 Apr 2021 01:33:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bobmiller at nvidia dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Apr 2021 01:33:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100279 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=3D50683&action=3Dedit 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:=20 ---------------------------- template struct T {}; template void E(F &&) {} template void E(F &&f) { f(T{}); E(f); } void foo() { E<-1.0, -2.0>( [&](T){}); } 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 a= nd -2.0L) results in valid generated code. ------------------ Output from gcc -v: COLLECT_GCC=3Dg++-11 COLLECT_LTO_WRAPPER=3D/home/bob/libexec/gcc/x86_64-linux-gnu/12.0.0/lto-wra= pper Target: x86_64-linux-gnu Configured with: ../gcc/configure -v --build=3Dx86_64-linux-gnu --host=3Dx86_64-linux-gnu --target=3Dx86_64-linux-gnu --prefix=3D/home/bob/ --enable-checking=3Drelease --enable-languages=3Dc,c++ --disable-multilib --program-suffix=3D-11 Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20210426 (experimental) (GCC)=20 Command line to trigger bug: g++-11 --std=3Dc++20 bugtest.cpp -o test Compiler output: /tmp/ccmrd0Wr.s: Assembler messages: /tmp/ccmrd0Wr.s:106: Error: symbol `_ZZ3foovENKUl1TIXT_EEE_clILdffffffff00000000EEEDaS0_' is already defined=