public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/37398] New: Statement functions mask missing PURE procedures.
@ 2008-09-06 16:56 dominiq at lps dot ens dot fr
2008-09-06 18:16 ` [Bug fortran/37398] " burnus at gcc dot gnu dot org
2009-12-08 21:05 ` dfranke at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-09-06 16:56 UTC (permalink / raw)
To: gcc-bugs
Following the fix of pr35837 by Daniel Kraft (thanks for it) I found that it
also fixed a reject-valid bug for the comment #1 in pr29389. In the process
this uncovered an accept-invalid bug as shown by the following modification of
gfortran.dg/stfunc_6.f90:
! { dg-do compile }
! Tests the fix for the second bit of PR29389, in which the
! statement function would not be recognised as not PURE
! when it referenced a procedure that is not PURE.
!
! This is based on stfunc_4.f90 with the statement function made
! impure by a reference to 'v'.
!
! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
INTEGER :: st1, i = 99, a(4), q = 6
st1 (i) = i * i * i
st3 (i) = i * v(i) ! This Ok
FORALL(i=1:4) a(i) = st1 (i)
FORALL(i=1:4) a(i) = u (a(i)) - a(i)** 2
if (any (a .ne. 0)) call abort ()
if (i .ne. 99) call abort ()
FORALL(i=1:4) a(i) = st3 (i) ! This should give "Error: reference to non-PURE
'v' at (1) is inside a FORALL block"
FORALL(i=1:4) a(i) = v (i) ! This gives "Error: reference to non-PURE 'v' at
(1) is inside a FORALL block"
contains
pure integer function u (x)
integer,intent(in) :: x
st2 (i) = i * v(i) ! { dg-error "non-PURE procedure" }
u = st2(x)
end function
integer function v (x)
integer,intent(in) :: x
v = i
end function
end
Since v() is not PURE, st3() is also not PURE and its use in a FORALL construct
should be rejected as it is for v(). Note that the same constraint applies for
the mask. So far I have been unable to see if a similar constraint applies for
WHERE blocks.
--
Summary: Statement functions mask missing PURE procedures.
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dominiq at lps dot ens dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37398
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/37398] Statement functions mask missing PURE procedures.
2008-09-06 16:56 [Bug fortran/37398] New: Statement functions mask missing PURE procedures dominiq at lps dot ens dot fr
@ 2008-09-06 18:16 ` burnus at gcc dot gnu dot org
2009-12-08 21:05 ` dfranke at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-09-06 18:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2008-09-06 18:15 -------
The problem seems to be that "impure_stmt_fcn" for "st3" never checks "v".
If I add some printfs, I see that "impure_stmt_fcn" is called twice with
sym->name == "st3"; once with e->symtree->n.sym = st3 and once with
e->symtree->n.sym = x.
One could really walk through the expressions of the statement function;
another possibility is to mark the statement function as pure/not-pure when
resolving the statement function - and later one can then check in
"impure_stmt_fcn" whether the statement function is pure or not.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |accepts-invalid
Last reconfirmed|0000-00-00 00:00:00 |2008-09-06 18:15:11
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37398
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/37398] Statement functions mask missing PURE procedures.
2008-09-06 16:56 [Bug fortran/37398] New: Statement functions mask missing PURE procedures dominiq at lps dot ens dot fr
2008-09-06 18:16 ` [Bug fortran/37398] " burnus at gcc dot gnu dot org
@ 2009-12-08 21:05 ` dfranke at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-08 21:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from dfranke at gcc dot gnu dot org 2009-12-08 21:04 -------
*** Bug 38733 has been marked as a duplicate of this bug. ***
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jv244 at cam dot ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37398
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-08 21:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-06 16:56 [Bug fortran/37398] New: Statement functions mask missing PURE procedures dominiq at lps dot ens dot fr
2008-09-06 18:16 ` [Bug fortran/37398] " burnus at gcc dot gnu dot org
2009-12-08 21:05 ` dfranke at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).