This is the mail archive of the gcc-bugs@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]

[Bug fortran/32386] Pure function not allowed in specification expression



------- Comment #8 from John dot Harper at mcs dot vuw dot ac dot nz  2007-06-19 01:13 -------
Subject: Re:  Pure function not allowed in specification
 expression

On Tue, 18 Jun 2007, pault at gcc dot gnu dot org wrote:

> Date: 18 Jun 2007 22:49:37 -0000
> From: pault at gcc dot gnu dot org <gcc-bugzilla@gcc.gnu.org>
> To: john.harper@vuw.ac.nz
> Subject: [Bug fortran/32386] Pure function not allowed in specification
>     expression
> 
>
>
> ------- Comment #7 from pault at gcc dot gnu dot org  2007-06-18 22:49 -------
> John,
>
> 5.1
> .....many snips.....
> ....If a specification-expr involves a reference to a specification function
> (7.1.6.2), the expression is considered to be a nonconstant expression. If the
> data object being declared depends on the value of such a nonconstant
> expression and is not a dummy argument, such an object is called an automatic
> data object.
>
> I can see why you should think that this is OK.  However, this section of the
> standard says otherwise.  In fact, there is a practical consideration, which
> probably drives the standard:
>
> This character length cannot be computed at compilation time because the
> specification function is needed.  Automatic objects in procedures have their
> variable properties calculated in the interface, which is not available for the
> main program. Thus, even were this legal code, I would not have the slightest
> idea how to implement it.
>
> My vote is that this is invalid.

I now agree the code was invalid - I had found 7.1.6.2 but overlooked 
5.1 before sending the bug report. You may be amused to know that some 
compilers do implement that type of automatic data object: g95 and Sun 
f95. However Compaq f95 and NAG f95 disallow it. I don't think a bug
report to g95 or Sun is warranted though: the part of 5.1 that the
program violates is not in a Constraint.

-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5341 fax (+64)(4)463 5045


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32386


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]