diff options
author | Tobias Burnus <burnus@net-b.de> | 2011-06-05 23:11:46 +0200 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2011-06-05 23:11:46 +0200 |
commit | 8d231ff273dc0d9d4937be8cd0c5ee53a000cf7a (patch) | |
tree | 8b459bf11bf34751da79a5ac42ef725dd5a22f4c /gcc/fortran/trans-expr.c | |
parent | e8f79869d7d78364931e69665b9c8f876fa1bb73 (diff) | |
download | gcc-8d231ff273dc0d9d4937be8cd0c5ee53a000cf7a.zip gcc-8d231ff273dc0d9d4937be8cd0c5ee53a000cf7a.tar.gz gcc-8d231ff273dc0d9d4937be8cd0c5ee53a000cf7a.tar.bz2 |
re PR fortran/49255 (-fcheck=pointer diagnoses too much: Passing NULL pointer to OPTIONAL argument)
2011-06-05 Tobias Burnus <burnus@net-b.de>
PR fortran/49255
* trans-expr.c (gfc_conv_procedure_call): Fix -fcheck=pointer
for F2008.
2011-06-05 Tobias Burnus <burnus@net-b.de>
PR fortran/49255
* gfortran.dg/pointer_check_9.f90: New.
* gfortran.dg/pointer_check_10.f90: New.
From-SVN: r174663
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index bfe966f..da4af1a 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -3269,6 +3269,12 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, else goto end_pointer_check; + /* In Fortran 2008 it's allowed to pass a NULL pointer/nonallocated + allocatable to an optional dummy, cf. 12.5.2.12. */ + if (fsym != NULL && fsym->attr.optional && !attr.proc_pointer + && (gfc_option.allow_std & GFC_STD_F2008) != 0) + goto end_pointer_check; + if (attr.optional) { /* If the actual argument is an optional pointer/allocatable and |