public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/49255] New: -fcheck=pointer diagnosts too much: Passing NULL pointer to OPTIONAL argument @ 2011-06-01 13:12 burnus at gcc dot gnu.org 2011-06-02 5:55 ` [Bug fortran/49255] -fcheck=pointer diagnoses " burnus at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: burnus at gcc dot gnu.org @ 2011-06-01 13:12 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49255 Summary: -fcheck=pointer diagnosts too much: Passing NULL pointer to OPTIONAL argument Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: diagnostic, patch, rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org Valid F2008 test case: integer,pointer :: ptr => null() call foo(ptr) contains subroutine foo (x) integer, optional :: x print *, present (x) end subroutine foo end But with -fcheck=pointer, gfortran prints at run time: At line 2 of file test.f90 Fortran runtime error: Pointer actual argument 'ptr' is not associated --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -3269,13 +3269,16 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, else goto end_pointer_check; - if (attr.optional) + if (attr.optional + && ((gfc_option.allow_std & GFC_STD_F2008) == 0 + || attr.proc_pointer)) { /* If the actual argument is an optional pointer/allocatable and the formal argument takes an nonpointer optional value, it is invalid to pass a non-present argument on, even though there is no technical reason for this in gfortran. - See Fortran 2003, Section 12.4.1.6 item (7)+(8). */ + See Fortran 2003, Section 12.4.1.6 item (7)+(8). + In Fortran 2008 that's allowed; cf. 12.5.2.12. */ tree present, null_ptr, type; if (attr.allocatable ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/49255] -fcheck=pointer diagnoses too much: Passing NULL pointer to OPTIONAL argument 2011-06-01 13:12 [Bug fortran/49255] New: -fcheck=pointer diagnosts too much: Passing NULL pointer to OPTIONAL argument burnus at gcc dot gnu.org @ 2011-06-02 5:55 ` burnus at gcc dot gnu.org 2011-06-05 21:12 ` burnus at gcc dot gnu.org 2011-06-05 21:13 ` burnus at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: burnus at gcc dot gnu.org @ 2011-06-02 5:55 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49255 --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-02 05:54:53 UTC --- The patch was not quite correct... Submitted patch: http://gcc.gnu.org/ml/fortran/2011-06/msg00015.html ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/49255] -fcheck=pointer diagnoses too much: Passing NULL pointer to OPTIONAL argument 2011-06-01 13:12 [Bug fortran/49255] New: -fcheck=pointer diagnosts too much: Passing NULL pointer to OPTIONAL argument burnus at gcc dot gnu.org 2011-06-02 5:55 ` [Bug fortran/49255] -fcheck=pointer diagnoses " burnus at gcc dot gnu.org @ 2011-06-05 21:12 ` burnus at gcc dot gnu.org 2011-06-05 21:13 ` burnus at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: burnus at gcc dot gnu.org @ 2011-06-05 21:12 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49255 --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-05 21:11:49 UTC --- Author: burnus Date: Sun Jun 5 21:11:46 2011 New Revision: 174663 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174663 Log: 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. Added: trunk/gcc/testsuite/gfortran.dg/pointer_check_10.f90 trunk/gcc/testsuite/gfortran.dg/pointer_check_9.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/trans-expr.c trunk/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/49255] -fcheck=pointer diagnoses too much: Passing NULL pointer to OPTIONAL argument 2011-06-01 13:12 [Bug fortran/49255] New: -fcheck=pointer diagnosts too much: Passing NULL pointer to OPTIONAL argument burnus at gcc dot gnu.org 2011-06-02 5:55 ` [Bug fortran/49255] -fcheck=pointer diagnoses " burnus at gcc dot gnu.org 2011-06-05 21:12 ` burnus at gcc dot gnu.org @ 2011-06-05 21:13 ` burnus at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: burnus at gcc dot gnu.org @ 2011-06-05 21:13 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49255 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED --- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-05 21:13:26 UTC --- FIXED (4.7 trunk). ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-05 21:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-06-01 13:12 [Bug fortran/49255] New: -fcheck=pointer diagnosts too much: Passing NULL pointer to OPTIONAL argument burnus at gcc dot gnu.org 2011-06-02 5:55 ` [Bug fortran/49255] -fcheck=pointer diagnoses " burnus at gcc dot gnu.org 2011-06-05 21:12 ` burnus at gcc dot gnu.org 2011-06-05 21:13 ` burnus at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).