This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] Add -fnull-this-pointer
- From: Markus Trippelsdorf <markus at trippelsdorf dot de>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org, jason at redhat dot com, mliska at suse dot cz, tbsaunde+gcc at tbsaunde dot org
- Date: Tue, 19 Jan 2016 13:20:32 +0100
- Subject: Re: [C++] Add -fnull-this-pointer
- Authentication-results: sourceware.org; auth=none
- References: <20160119121143 dot GF5273 at kam dot mff dot cuni dot cz>
On 2016.01.19 at 13:11 +0100, Jan Hubicka wrote:
> according to Trevor, the assumption about THIS pointer being non-NULL breaks
> several bigger C++ packages (definitly including Firefox, but I believe
> kdevelop was mentioned, too). This patch makes the feature to be controlable
> by a dedicated flag. I am not sure about the default. We now have ubsan check
> for the bug so I would hope the codebases to be updated soon, but it did not
> happen for Firefox for quite a while despite the fact that Martin Liska reported
> it.
>
> This patch defaults to -fno-null-this-pointer, but I would be OK with changing
> the default and setting it on only in GCC 6. Main point of the patch is to
> avoid need of those packages to be built with -fno-delete-null-pointer-checks
> (which still subsumes the flag).
I can confirm that for QT-5, Chromium and Kdevelop this optimization
needs to be disabled. So it looks like a very common issue in large C++
codebases.
--
Markus