Bug 44666 - [F2008] Passing NULL pointer or unallocated allocatable to OPTIONAL dummy
Summary: [F2008] Passing NULL pointer or unallocated allocatable to OPTIONAL dummy
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
Depends on:
Blocks: F2008
  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:
Known to work:
Known to fail:
Last reconfirmed:


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
" 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