public inbox for gcc-cvs-wwwdocs@sourceware.org help / color / mirror / Atom feed
From: Martin Jambor <jamborm@sourceware.org> To: gcc-cvs-wwwdocs@gcc.gnu.org Subject: gcc-wwwdocs branch master updated. d2323d3efa30008ed05519a398eb7fe1e9b446d3 Date: Thu, 2 May 2024 21:42:43 +0000 (GMT) [thread overview] Message-ID: <20240502214243.60162385E836@sourceware.org> (raw) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "gcc-wwwdocs". The branch, master has been updated via d2323d3efa30008ed05519a398eb7fe1e9b446d3 (commit) from 6c84b7b936a085c13e1f33f2028317fe31bbbcd8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d2323d3efa30008ed05519a398eb7fe1e9b446d3 Author: Martin Jambor <mjambor@suse.cz> Date: Thu May 2 23:40:22 2024 +0200 Describe gcc target pragma changes in gcc-14/porting_to.html Adding a subsection on how gcc target pragma changed in GCC 14 in the corresponding porting-to document. diff --git a/htdocs/gcc-14/porting_to.html b/htdocs/gcc-14/porting_to.html index c825a68e..a20d82c2 100644 --- a/htdocs/gcc-14/porting_to.html +++ b/htdocs/gcc-14/porting_to.html @@ -514,6 +514,48 @@ be included explicitly when compiling with GCC 14: </li> </ul> +<h3 id="target-pragma">Pragma GCC target now affects preprocessor symbols</h4> + +<p> +The behavior of pragma GCC target and specifically how it affects ISA +macros has changed in GCC 14. In GCC 13 and older, the <code>GCC +target</code> pragma defined and undefined corresponding ISA macros in +C when using the integrated preprocessor during compilation but not +when the preprocessor was invoked as a separate step or when using +the <code>-save-temps</code> option. In C++ the ISA macro definitions +were performed in a way which did not have any actual effect. + +In GCC 14 C++ behaves like C with integrated preprocessing in earlier +versions. Moreover, in both languages ISA macros are defined and +undefined as expected when preprocessing separately from compilation. + +<p> +This can lead to different behavior, especially in C++. For example, +a part of the C++ snippet below will be (silently) compiled for an +incorrect instruction set by GCC 14. + +<pre> + #if ! __AVX2__ + #pragma GCC push_options + #pragma GCC target("avx2") + #endif + + /* Code to be compiled for AVX2. */ + + /* With GCC 14, __AVX2__ here will always be defined and pop_options + never invoked. */ + #if ! __AVX2__ + #pragma GCC pop_options + #endif + + /* With GCC 14, all following functions will be compiled for AVX2 + which was not intended. */ +</pre> + +<p> +The fix in this case is to remember whether <code>pop_options</code> +needs to be performed in a new user-defined macro. + <!-- <h2 id="fortran">Fortran language issues</h2> --> </body> ----------------------------------------------------------------------- Summary of changes: htdocs/gcc-14/porting_to.html | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) hooks/post-receive -- gcc-wwwdocs
reply other threads:[~2024-05-02 21:42 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240502214243.60162385E836@sourceware.org \ --to=jamborm@sourceware.org \ --cc=gcc-cvs-wwwdocs@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).