[PATCH] fix PR39701 testsuite failures

H.J. Lu hjl.tools@gmail.com
Fri Apr 10 17:10:00 GMT 2009


On Fri, Apr 10, 2009 at 1:14 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Fri, Apr 10, 2009 at 9:17 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
>> Interestingly enough, these failures had three different root causes,
>> and each of them triggered a different observation on something dubious
>> in GCC.
>>
>> One was due to a disabled folding due to my patch when
>> -fno-delete-null-pointer-checks (including -O0 -O1).  I fixed this by
>> considering &x to be non-zero if x is stack allocated.
>
> This part is ok for trunk.
>
>>  Observation: I think however that it does not make sense to have
>>  -fdelete-null-pointer-checks only at -O2 or higher -- it it is not
>>  an optimization option, rather it describes the semantics of the
>>  target, and it should be enabled uniformly at all optimization levels.
>>  If there are places that we consider optimizations, they should be
>>  guarded by "(optimize >= 2 && flag_delete_null_pointer_checks).
>
> I agree.  A patch to make -fdelete-null-pointer-checks enabled by
> default is pre-approved (it likely needs documentation changes).
>
> Thanks,
> Richard.
>

I will check it in after testing.

Thanks.


-- 
H.J.
---
2009-04-10  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/39701
	* common.opt (-fdelete-null-pointer-checks): Initialize to 1.

	* opts.c (decode_options): Don't set flag_delete_null_pointer_checks
	here.

	* doc/invoke.texi: Update -fdelete-null-pointer-checks.
-------------- next part --------------
2009-04-10  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/39701
	* common.opt (-fdelete-null-pointer-checks): Initialize to 1.

	* opts.c (decode_options): Don't set flag_delete_null_pointer_checks
	here.

	* doc/invoke.texi: Update -fdelete-null-pointer-checks.

--- gcc/common.opt.pr39701	2009-04-09 12:53:37.000000000 -0700
+++ gcc/common.opt	2009-04-10 09:58:24.000000000 -0700
@@ -436,7 +436,7 @@ Common Report Var(flag_delayed_branch) O
 Attempt to fill delay slots of branch instructions
 
 fdelete-null-pointer-checks
-Common Report Var(flag_delete_null_pointer_checks) Optimization
+Common Report Var(flag_delete_null_pointer_checks) Init(1) Optimization
 Delete useless null pointer checks
 
 fdiagnostics-show-location=
--- gcc/doc/invoke.texi.pr39701	2009-04-10 09:33:30.000000000 -0700
+++ gcc/doc/invoke.texi	2009-04-10 10:04:36.000000000 -0700
@@ -5898,7 +5898,7 @@ safely dereference null pointers.  Use
 @option{-fno-delete-null-pointer-checks} to disable this optimization
 for programs which depend on that behavior.
 
-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+Enabled by default.
 
 @item -fexpensive-optimizations
 @opindex fexpensive-optimizations
--- gcc/opts.c.pr39701	2009-04-10 10:02:47.000000000 -0700
+++ gcc/opts.c	2009-04-10 10:01:44.000000000 -0700
@@ -894,7 +894,6 @@ decode_options (unsigned int argc, const
   flag_regmove = opt2;
   flag_strict_aliasing = opt2;
   flag_strict_overflow = opt2;
-  flag_delete_null_pointer_checks = opt2;
   flag_reorder_blocks = opt2;
   flag_reorder_functions = opt2;
   flag_tree_vrp = opt2;


More information about the Gcc-patches mailing list