public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "malat at debian dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111522] Different code path for static initialization with flto Date: Fri, 29 Sep 2023 14:41:56 +0000 [thread overview] Message-ID: <bug-111522-4-qlUSwxCJxE@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-111522-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111522 --- Comment #11 from Mathieu Malaterre <malat at debian dot org> --- Here is a dead simple reduced version: ``` % cat pr111522.cc #include <iostream> #include <cstring> #pragma GCC push_options #pragma GCC target "cpu=power10" float BitCast(int in) { float out; memcpy(&out, &in, sizeof(out)); return out; } float kNearOneF = BitCast(1065353215); #pragma GCC pop_options int main() { std::cout << kNearOneF << std::endl; } ``` You can compare: g++ -o works -O2 pr111522.cc -Wall -Wextra -Werror -Wfatal-errors vs g++ -o fails -flto -O2 pr111522.cc -Wall -Wextra -Werror -Wfatal-errors For some reason, `-flto` rightfully generates a `xxspltidp` instruction: (gdb) display/i $pc 1: x/i $pc => 0x100000940 <_Z7BitCasti.constprop.0>: xxspltidp vs1,1065353215 I am not sure I understand the behavior of the non LTO case now...
next prev parent reply other threads:[~2023-09-29 14:41 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-21 15:04 [Bug target/111522] New: " malat at debian dot org 2023-09-21 15:53 ` [Bug target/111522] " pinskia at gcc dot gnu.org 2023-09-25 7:07 ` malat at debian dot org 2023-09-25 7:08 ` malat at debian dot org 2023-09-25 7:14 ` malat at debian dot org 2023-09-25 7:23 ` pinskia at gcc dot gnu.org 2023-09-25 9:10 ` malat at debian dot org 2023-09-25 10:28 ` malat at debian dot org 2023-09-25 10:33 ` malat at debian dot org 2023-09-25 10:34 ` malat at debian dot org 2023-09-25 10:36 ` malat at debian dot org 2023-09-29 14:41 ` malat at debian dot org [this message] 2023-10-16 9:07 ` linkw at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-111522-4-qlUSwxCJxE@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).