This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/41627] mixing common and modules elicits seg fault
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Oct 2009 08:43:45 -0000
- Subject: [Bug fortran/41627] mixing common and modules elicits seg fault
- References: <bug-41627-17946@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from dominiq at lps dot ens dot fr 2009-10-08 08:43 -------
The use of common in the context of this PR badly hurts my understanding of
commons: storage arrays computed at compile time. The standard says (f2008):
5.7.2 COMMON statement
5.7.2.1 General
1 The COMMON statement specifies blocks of physical storage, called common
blocks, that can be accessed by any of the scoping units in a program.
Thus, the COMMON statement provides a global data facility based on
storage association (16.5.3).
2 A common block that does not have a name is called blank common.
R568 common-stmt is COMMON
[ / [ common-block-name ] / ] common-block-object-list
[ [ , ] / [ common-block-name ] /
common-block-object-list ] ...
R569 common-block-object is variable-name [ ( array-spec ) ]
or proc-pointer-name
C595 (R569) An array-spec in a common-block-object shall be an
explicit-shape-spec-list.
C596 (R569) Only one appearance of a given variable-name or
proc-pointer-name is permitted in all common-block-object-lists within a
scoping unit.
C597 (R569) A common-block-object shall not be a dummy argument, a result
variable, an allocatable variable, a derived-type object with an ultimate
component that is allocatable, an automatic object, a variable with the
BIND attribute, an unlimited polymorphic pointer, or a coarray.
C598 (R569) If a common-block-object is of a derived type, the type shall
have the BIND attribute or the SEQUENCE attribute and it shall have no
default initialization.
C599 (R569) A variable-name or proc-pointer-name shall not be a name made
accessible by use association.
5.3.8.2 Explicit-shape array
R516 explicit-shape-spec is [ lower-bound : ] upper-bound
R517 lower-bound is specification-expr
R518 upper-bound is specification-expr
C531 (R516) An explicit-shape-spec whose bounds are not constant
expressions shall appear only in a subprogram, derived type definition,
or interface body.
1 An explicit-shape array is an array whose shape is explicitly declared by
an explicit-shape-spec-list. The rank is equal to the number of
explicit-shape-specs.
2 An explicit-shape array that is a named local variable of a subprogram or
BLOCK construct may have bounds that are not constant expressions. The
bounds, and hence shape, are determined at entry to a procedure de ned by
the subprogram, or on execution of the BLOCK statement, by evaluating the
bounds' expressions. The bounds of such an array are una ected by the
rede nition or unde nition of any variable during execution of the
procedure or BLOCK construct.
3 The values of each lower-bound and upper-bound determine the bounds of
the array along a particular dimension and hence the extent of the array
in that dimension. If lower-bound appears it speci es the lower bound;
otherwise the lower bound is 1. The value of a lower bound or an upper
bound may be positive, negative, or zero. The subscript range of the
array in that dimension is the set of integer values between and
including the lower and upper bounds, provided the upper bound is not
less than the lower bound. If the upper bound is less than the lower
bound, the range is empty, the extent in that dimension is zero, and the
array is of zero size.
1 1.3.10
automatic data object
automatic object
nondummy data object with a type parameter or array bound that depends on
the value of a speci cation-expr that is not an constant expression
I cannot see how
real, pointer, dimension(:) :: ro
can defines an explicit-shape array or a non-automatic object. So is the use of
common in this PR valid or not?
Note that if C595 or C597 applies, the burden is probably on the compiler.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41627