[Patch, Fortran] PR50718 Fix -fcheck=pointer 4.6/4.7 regression

Tobias Burnus burnus@net-b.de
Fri Oct 14 11:45:00 GMT 2011


while testing my constructor draft patch with FGSL, I found two bugs 
(4.6/4.7 regressions): PR target/50721 (segfault on x86-64 after 
execution - one of the rare -O0 only bugs) - and while trying to debug 
it, I found this bug.

The problem is that for -fcheck=pointer, gfortran expects a pointer for 
the "if (actual_arg == NULL)" check; however, if the dummy has the VALUE 
attribute, one has "*actual_arg". The solution is to strip off the "*" 
for the pointer check. Without the patch, one gets an ICE when comparing 
a derived type (instead of a pointer to a DT) with NULL.

While writing the test case, I realized that there is also the %VAL() 
method of generating a nonpointer should be also tested for. As the 
actual argument in the test case (*_12.f90) is not a record type (DT) 
but a simple integer, comparing "%VAL(p) == NULL" works (but is bogus). 
Result without the patch: Segfault at run time instead of an ICE. With 
the patch, one gets the nice  run-time error message.

Build and regtested on x86-64-linux.
OK for the trunk and 4.6?


PS: *Pre-ping* for the pending review of as simple documentation/flag 
patch: http://gcc.gnu.org/ml/fortran/2011-10/msg00073.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pointer-check-value-fix.diff
Type: text/x-patch
Size: 2464 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20111014/933eee67/attachment.bin>

More information about the Gcc-patches mailing list