Bug 44666 - [F2008] Passing NULL pointer or unallocated allocatable to OPTIONAL dummy
Summary: [F2008] Passing NULL pointer or unallocated allocatable to OPTIONAL dummy
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 39627
  Show dependency treegraph
 
Reported: 2010-06-25 14:36 UTC by Tobias Burnus
Modified: 2010-08-15 16:26 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2010-06-25 14:36:50 UTC
"12.5.2.12 Argument presence and restrictions on arguments not present

A dummy argument or an entity that is host associated with a dummy argument is not present if the dummy argument
[...]
* does not have the ALLOCATABLE or POINTER attribute, and corresponds to an
  actual argument that
  - has the ALLOCATABLE attribute and is not allocated, or
  - has the POINTER attribute and is disassociated."

That probably means:

a) NULL(mold) as actual argument is allowed
b) For scalars, it should just work
c) For arguments with descriptors, one needs to add:
   (actual.data == NULL) ? NULL : actual
Comment 1 Tobias Burnus 2010-08-15 16:26:42 UTC
FIXED on the 4.6 trunk.

I have missed to include the PR when writing, submitting, and committing the patch. It can be found at:

Patch: http://gcc.gnu.org/ml/fortran/2010-08/msg00174.html
Committal: http://gcc.gnu.org/ml/gcc-cvs/2010-08/msg00474.html