This is the mail archive of the
`gcc-patches@gcc.gnu.org`
mailing list for the GCC project.

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |

Other format: | [Raw text] |

*From*: Tobias Burnus <burnus at net-b dot de>*To*: Janus Weil <janus at gcc dot gnu dot org>*Cc*: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>*Date*: Mon, 26 Jul 2010 08:14:55 +0200*Subject*: Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)*References*: <AANLkTikqPGiqzXRyG6BtQGH4X_Bsc5yR6RQQdvDbjLxg@mail.gmail.com> <4C461784.5020801@net-b.de> <AANLkTimDPrbDIOXWM3d2RojHNFVY6PMgsre-mhFAxJNi@mail.gmail.com> <4C477930.5060702@net-b.de> <AANLkTin8UoGCGkT9rFG0habYlh7Xr8mjP8MHe9M9qulT@mail.gmail.com>

Janus Weil wrote: >> Can you add a comment before the gfc_is_constant_expr to state what the >> function is actually doing (e.g. checking for specification expressions >> while taking additionally the given constraints into account.) >> > Well, it's actually not checking for specification expressions (which > is what gfc_specification_expr does), but it checks for constant > expressions, which are defined in chapter 7.1.12 of F08. > No, it does not. A Fortran 2008 constant expression is a Fortran 2003 initialization expression and for array bounds one does not check for F2008 constant/F2003 initialization expressions otherwise automatic arrays would not be possible. Seemingly, the gfortran names are based on Fortran 95 - thus looking at F2003/F2008 does not help if one want to know what it meant. I think we urgently need to add in the comment a reference to the relevant sections (and terms) of all three standards - otherwise, one gets completely confused. That's seems to be complicated by the problem that Fortran 95 seems define have four terms while Fortran 2003 and Fortran 2008 define only three terms. In particular, F95 has constant and initialization expressions, F2003 has initialization expressions, and F2008 has constant expressions. I think I will print out the few pages of the three standard and try to get an idea how the terms relate in the different standards. Fortran 95 has: * [7.1.6.1] A *constant expression* is an expression in which each operation is intrinsic and each primary is [...] * [7.1.6.1] An *initialization expression* is a constant expression in which the exponentiation operation is permitted only with an integer power, and each primary is [...] * [7.1.6.2] A *specification expression* is an expression with limitations that make it suitable for use in specifications such as character lengths (R510) and array bounds (R515, R516). A constant specification expression is a specification expression that is also a constant expression. * [7.1.6.2] A *restricted expression* is an expression in which each operation is intrinsic and each primary is [...] Fortran 2003 has: * [7.1.6] A *specification expression* is an expression with limitations that make it suitable for use in specifications such as length type parameters (C501) and array bounds (R512, R513). [....] * [7.1.6] A *restricted expression* is an expression in which each operation is intrinsic and each primary is [...] * [7.1.7] An *initialization expression* is an expression with limitations that make it suitable for use as a kind type parameter, initializer, or named constant. It is an expression in which each operation is intrinsic, and each primary is [...] Fortran 2008 has: * [7.1.11] A *specification expression* is an expression with limitations that make it suitable for use in specifications such as length type parameters (C404) and array bounds (R517, R518). A specification-expr shall be a constant expression unless it is in an interface body (12.4.3.2), the specification part of a subprogram or BLOCK construct, a derived-type definition, or the declaration-type-spec of a FUNCTION statement (12.6.2.2). [...] * [7.1.11] A *restricted expression* is an expression in which each operation is intrinsic or dened by a specification function and each primary is [...] * [7.1.12] A *constant expression* is an expression with limitations that make it suitable for use as a kind type parameter, initializer, or named constant. It is an expression in which each operation is intrinsic, and each primary is [...] And gfortran has: * gfc_is_constant_expr: Function to determine if an expression is constant or not. This function expects that the expression has already been simplified. * check_restricted: Verify that an expression is a restricted expression. Like its cousin check_init_expr(), an error message is generated if we return FAILURE. * check_init_expr: Verify that an expression is an initialization expression. [...] * gfc_specification_expr: Check to see that an expression is a specification expression. If we return FAILURE, an error has been generated. Tobias

**Follow-Ups**:

**References**:**[Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)***From:*Janus Weil

**Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)***From:*Tobias Burnus

**Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)***From:*Janus Weil

**Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)***From:*Tobias Burnus

**Re: [Patch, Fortran, OOP] PR 44962: [OOP] ICE with specification expression SIZE(<CLASS>)***From:*Janus Weil

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |