diff mbox series

[committed] GCC 11 changes

Message ID e6dfe90a-7b11-4288-52df-b25076538a20@gmail.com
State New
Headers show
Series [committed] GCC 11 changes | expand

Commit Message

Martin Sebor Feb. 10, 2021, 12:15 a.m. UTC
I pushed the attached change documenting my GCC 11 changes.

I validated the file on https://validator.w3.org.

Martin
diff mbox series

Patch

commit cf0d4e41a94bae204a8c5d2490063d58cdb1d4e3
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Feb 9 17:12:16 2021 -0700

    Update new attribute malloc and document new and enhanced warnings.

diff --git a/htdocs/gcc-11/changes.html b/htdocs/gcc-11/changes.html
index 63efaf37..80d39b73 100644
--- a/htdocs/gcc-11/changes.html
+++ b/htdocs/gcc-11/changes.html
@@ -179,21 +179,47 @@  a work-in-progress.</p>
 	<li>The existing
 	  <a href="https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute"><code>malloc</code></a>
 	  attribute has been extended so that it can be used to identify
-	  allocator/deallocator API pairs.  A new
-	  <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#-Wmismatched-dealloc"><code>-Wmismatched-dealloc</code></a>
-	  warning will complain about incorrect calls.  Additionally, the
-	  static analyzer will use these attributes when checking for leaks,
-	  double-frees, use-after-frees, and similar issues.
+	  allocator/deallocator API pairs.  A pair of new
+	  <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmismatched-dealloc"><code>-Wmismatched-dealloc</code></a> and <a href="https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wmismatched-new-delete"><code>-Wmismatched-new-delete</code></a> warnings will complain
+	  about mismatched calls, and <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wfree-nonheap-object"><code>-Wfree-nonheap-object</code></a> about deallocation calls with pointers not obtained from allocation
+	  functions.  Additionally, the static analyzer will use these
+	  attributes when checking for leaks, double-frees, use-after-frees,
+	  and similar issues.
 	</li>
     </ul>
   <li>New warnings:
     <ul>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmismatched-dealloc"><code>-Wmismatched-dealloc</code></a>,
+	enabled by default, warns about calls to deallocation functions
+	with pointers returned from mismatched allocation functions.
+      </li>
       <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wsizeof-array-div"><code>-Wsizeof-array-div</code></a>,
 	  enabled by <code>-Wall</code>, warns
 	  about divisions of two sizeof operators when the first one is applied
 	  to an array and the divisor does not equal the size of the array
 	  element.
       </li>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overread"><code>-Wstringop-overread</code></a>,
+	enabled by default, warns about calls to string functions reading
+	past the end of the arrays passed to them as arguments.  In prior
+	GCC releases most instances of his warning are diagnosed by
+	<code>-Wstringop-overflow</code>.
+      </li>
+    </ul>
+  </li>
+  <li>Enhancements to existing warnings:
+    <ul>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wfree-nonheap-object"><code>-Wfree-nonheap-object</code></a>
+	detects many more instances of calls to deallocation functions with
+	pointers not returned from a dynamic memory allocation function.
+      </li>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmaybe-uninitialized"><code>-Wmaybe-uninitialized</code></a>
+	diagnoses passing pointers or references to uninitialized memory
+	to functions taking <code>const</code>-qualified arguments.
+      </li>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wuninitialized"><code>-Wuninitialized</code></a>
+	detects reads from uninitialized dynamically allocated memory.
+      </li>
     </ul>
   </li>
   <li>
@@ -275,6 +301,22 @@  a work-in-progress.</p>
     <li>Labels may appear before declarations and at the end of a
     compound statement.</li>
   </ul></li>
+  <li>New warnings:
+    <ul>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Warray-parameter"><code>-Warray-parameter</code></a>,
+	enabled by <code>-Wall</code>, warns about redeclarations of functions
+	with ordinary array arguments declared using inconsistent forms.
+	The warning also enables the detection of the likely out of bounds
+	accesses in calls to such functions with smaller arrays.
+      </li>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wvla-parameter"><code>-Wvla-parameter</code></a>,
+	enabled by <code>-Wall</code>, warns redeclarations of functions
+	with variable length array arguments declared using inconsistent
+	forms or with mismatched bounds.  The warning also enables
+	the detection of the likely out of bounds accesses in calls to
+	such functions with smaller arrays.
+      </li>
+    </ul>
 </ul>
 
 <h3 id="cxx">C++</h3>
@@ -351,12 +393,27 @@  a work-in-progress.</p>
 	  one is of enumeration type and the other is of a floating-point type,
 	  as outlined in <em>[depr.arith.conv.enum]</em>.
       </li>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wmismatched-new-delete"><code>-Wmismatched-new-delete</code></a>,
+	enabled by <code>-Wall</code>, warns about calls to C++
+	<code>operator delete</code> with pointers returned from mismatched
+	forms of <code>operator new</code> or from other mismatched allocation
+	functions.
+      </li>
       <li><code>-Wvexing-parse</code>, enabled by default, warns about the most
 	  vexing parse rule: the cases when a declaration looks like a variable
 	  definition, but the C++ language requires it to be interpreted as a
 	  function declaration.
       </li>
     </ul>
+  <li>Enhancements to existing warnings:
+    <ul>
+      <li><a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wnonnull"><code>-Wnonnull</code></a>
+	considers the implicit <code>this</code> argument of every C++
+	nonstatic member function to have been implicitly declared with
+	attribute <code>nonnull</code> and triggers warnings for calls where
+	the pointer is null.
+      </li>
+    </ul>
   </li>
 </ul>