public inbox for gcc-cvs-wwwdocs@sourceware.org
help / color / mirror / Atom feed
* gcc-wwwdocs branch master updated. d2323d3efa30008ed05519a398eb7fe1e9b446d3
@ 2024-05-02 21:42 Martin Jambor
0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2024-05-02 21:42 UTC (permalink / raw)
To: gcc-cvs-wwwdocs
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-02 21:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-02 21:42 gcc-wwwdocs branch master updated. d2323d3efa30008ed05519a398eb7fe1e9b446d3 Martin Jambor
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).