public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "andrey.turkin at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/105120] New: __OPTIMIZE__ macro incorrectly defined when using pragma(optimize) with push_options/pop_options Date: Fri, 01 Apr 2022 06:38:43 +0000 [thread overview] Message-ID: <bug-105120-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105120 Bug ID: 105120 Summary: __OPTIMIZE__ macro incorrectly defined when using pragma(optimize) with push_options/pop_options Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: andrey.turkin at gmail dot com Target Milestone: --- Created attachment 52730 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52730&action=edit Sample code The code contains a "GCC optimize" pragma and some inline functions which are supposed to be optimized (that section is surrounded by push_options/pop_options which is supposed to protect following code from this pragma) and then some code which is using MMX intrinsics (see attached minified example). File is compiled with -O0 (or no optimization options at all - so "gcc sample.c" should suffice to reproduce this). The code following pop_options pragma should be unaffected by optimize pragma but it sees __OPTIMIZE__ macro defined even though optimization options are unaffected; this breaks the build because the source includes intrinsic headers which use this macro to select between intrinsic implementations. I put this bug into C component, not sure if that's exactly right. C++ is affected by this also though it is harder to reproduce. __OPTIMIZE__ is still incorrectly defined when compiling C++ but we can't see it because of bug 48026 (which makes it seem as if __OPTIMIZE__ is not defined at all). However if we put that entire push_options/pop_options section, and just it, in a separate header file and we PCH it then PCH state will still contain __OPTIMIZE__ macro defined and intrinsic headers will still use wrong implementation and everything still fails the same way. I tried gcc 9, 10, 11 and current trunk of 12 and results are the same for all of them.
next reply other threads:[~2022-04-01 6:38 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-01 6:38 andrey.turkin at gmail dot com [this message] 2022-04-01 7:01 ` [Bug c/105120] " rguenth at gcc dot gnu.org 2022-04-01 7:15 ` rguenth at gcc dot gnu.org 2022-04-01 7:33 ` andrey.turkin at gmail dot com
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-105120-4@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).