Attached is an updated diff rebased on top of the latest revision
of the file. This new version fixes the typos Paolo pointed out
(thanks) and adds a few more options:
-Wmissing-attributes, -Wif-not-aligned, and -Wpacked-not-aligned.
I used a spell-checker this time to (hopefully) minimize the typos.
The rest of the changes are described here:
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-8/changes.html,v
retrieving revision 1.52
diff -u -r1.52 changes.html
--- changes.html 4 Apr 2018 17:43:03 - 1.52
+++ changes.html 4 Apr 2018 22:21:49 -
@@ -1,4 +1,4 @@
GCC 8 Release Series Changes, New Features, and Fixes
@@ -9,7 +9,7 @@
-GCC 8 Release SeriesChanges, New Features, and Fixes
+GCC 8 Release SeriesChanges, New Features, and Fixes
This page is a "brief" summary of some of the huge number of improvements
@@ -113,6 +113,20 @@
possible for the user to have a finer-grained control over the loop
+GCC has been enhanced to detect more instances of meaningless or
+mutually exclusive attribute specifications and handle such conflicts
+more consistently. Mutually exclusive attribute specifications are
+ignored with a warning regardless of whether they appear on the same
+declaration or on distinct declarations of the same entity. For
+example, because the noreturn attribute on the second
+declaration below is mutually exclusive with the malloc
+attribute on the first, it is ignored and a warning is issued.
+ void* __attribute__ ((malloc)) f (unsigned);
+ void* __attribute__ ((noreturn)) f (unsigned);
+ warning: ignoring attribute 'noreturn' because it conflicts with attribute 'malloc' [-Wattributes]
@@ -172,10 +186,77 @@
New command-line options have been added for the C and C++ compilers:
- -Wmultistatement-macros warns about unsafe macros
- expanding to multiple statements used as a body of a clause such
- as if, else, while,
- switch, or for.
+ warns about unsafe macros expanding to multiple statements used
+ as a body of a statement such as if, else,
+ while, switch, or for.
+ warns for calls to bounded string manipulation functions such as
+ strncat, strncpy, and stpncpy
+ that might either truncate the copied string or leave the destination
+ unchanged. For example, the following call to strncat
+ is diagnosed because it appends just three of the four characters
+ from the source string.
+ void append (char *buf, size_t bufsize)
+ strncat (buf, ".txt", 3);
+ warning: 'strncat' output truncated copying 3 bytes from a string of length 4 [-Wstringop-truncation]
+ Similarly, in the following example, the call to strncpy
+ specifies the size of the destination buffer as the bound. If the
+ length of the source string is equal to or greater than this size
+ the result of the copy will not be NUL-terminated. Therefore,
+ the call is also diagnosed. To avoid the warning, specify
+ sizeof buf - 1 as the bound and set the last element of
+ the buffer to NUL.
+ void copy (const char *s)
+ char buf;
+ strncpy (buf, s, sizeof buf);
+ warning: 'strncpy' specified bound 80 equals destination size [-Wstringop-truncation]
+ The -Wstringop-truncation option is included in
+ Note that due to GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82944; title="missing -Wstringop-truncation on strncpy due to system header macro">82944, defining strncat, strncpy,
+ or stpncpy as a macro in a system header as some
+ implementations do suppresses the warning.
+ https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Warning-Options.html#index-Wif-not-aligned;>-Wif-not-aligned controls warnings issued in response
+ to invalid uses of objects declared with attribute
+ The -Wif-not-aligned option is included in
+ https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gcc/Warning-Options.html#index-Wmissing-attributes;>-Wmissing-attributes warns
+ when a declaration of a function is missing one or more attributes
+ that a related function is declared with and whose absence may
+ adversely affect the correctness or efficiency of generated code.
+ For example, in C++, the warning is issued when an explicit
+ specialization of a primary template declared with attribute
+ alloc_align, alloc_size,