This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [wwwdocs] Document null 'this' dereference issue in /gcc-6/porting_to.html
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Feb 2016 10:39:54 +0000
- Subject: Re: [wwwdocs] Document null 'this' dereference issue in /gcc-6/porting_to.html
- Authentication-results: sourceware.org; auth=none
- References: <20160209210636 dot GH8441 at redhat dot com>
On 09/02/16 21:06 +0000, Jonathan Wakely wrote:
This adds a note to the porting document about the (shockingly
widespread) problem of calling member functions through null pointers,
which GCC 6 no longer tolerates.
Following some comments about (bool)os I'm also tweaking another part
of the doc to use the plusplusgood static_cast form.
Committed to CVS.
Tweak to conform to our spelling conventions.
Committed to CVS.
Index: htdocs/gcc-6/porting_to.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-6/porting_to.html,v
retrieving revision 1.9
diff -u -r1.9 porting_to.html
--- htdocs/gcc-6/porting_to.html 10 Feb 2016 17:21:54 -0000 1.9
+++ htdocs/gcc-6/porting_to.html 11 Feb 2016 10:34:43 -0000
@@ -248,13 +248,13 @@
null, which is guaranteed by the language rules. Invalid programs which
assume it is OK to invoke a member function through a null pointer (possibly
relying on checks like <code>this != NULL</code>) may crash or otherwise fail
-at run-time if null pointer checks are optimized away.
+at run time if null pointer checks are optimized away.
With the <code>-Wnull-dereference</code> option the compiler tries to warn
when it detects such invalid code.
</p>
<p>
-If the program cannot be fixed to remove the undefined behaviour then the
+If the program cannot be fixed to remove the undefined behavior then the
option <code>-fno-delete-null-pointer-checks</code> can be used to disable
this optimization. That option also disables other optimizations involving
pointers, not only those involving <code>this</code>.