As reported by James Van Buskirk at http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/3aad8fb30b5174f4
Part of the reported issue is PR 41872. Remaining issue is: "13.7.9 ALLOCATED (ARRAY) or ALLOCATED (SCALAR) [...] Arguments. ARRAY shall be an allocatable array. SCALAR shall be an allocatable scalar." Namely: * ALLOCATABLE(SCALAR=<variable>) is not supported * No ARRAY=<scalar variable> is not rejected * invoke.texi must be updated: - @var{X} is wrong, it should be @var{ARRAY} and @var{SCALAR} - Standard version needs to be updated * * * I was thinking of updating intrinsic.c's "allocated" by using two optional arguments: ARRAY (ar) and SCALAR ("scalar") - and then doing the checking in check.c. However, as the check routine does not get the actual argument but only <gfc_actual_arglist>->expr, one can not distinguish ALLOCATABLE(scalar_var) ! Valid, first argument to check routine and ALLOCATABLE(array=scalar_var) ! Invalid, first argument to check routine Otherwise, one could use this method and use gfc_check_allocated (gfc_expr *array, gfc_expr *scalar) with checks for if (array == NULL && scalar == NULL) // Missing argument if (array != NULL && scalar != NULL) // Too many arguments if (scalar && scalar->rank != 0) // Invalid: SCALAR + Array However, if (array && array->rank == 0) does not work as this is also the case for ALLOCATED(scalar_var), which could only be distinguished using && <gfc_actual_arglist>->name != "" cf. above and intrinsic.c's do_check. Additionally, one needs to update gfc_conv_allocated to support two arguments - scalar and array (which can be also scalar w/o keyword=). -- Summary: ALLOCATED statement typo in the docs and for scalar variables Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42546