public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures
@ 2020-10-19 12:40 tkoenig at gcc dot gnu.org
2020-10-19 20:26 ` [Bug fortran/97491] " anlauf at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-10-19 12:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
Bug ID: 97491
Summary: Wrong restriction for VALUE arguments of pure
procedures
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
$ cat pure.f90
pure function foo(x) result (ret)
integer :: ret
integer, value :: x
x = x / 2
ret = x
end function foo
$ gfortran pure.f90
pure.f90:4:2:
4 | x = x / 2
| 1
Error: Variable 'x' cannot appear in a variable definition context (assignment)
at (1) in PURE procedure
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
@ 2020-10-19 20:26 ` anlauf at gcc dot gnu.org
2020-10-24 21:00 ` anlauf at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-19 20:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
Last reconfirmed| |2020-10-19
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.
I've looked at gfc_impure_variable, but do not understand it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
2020-10-19 20:26 ` [Bug fortran/97491] " anlauf at gcc dot gnu.org
@ 2020-10-24 21:00 ` anlauf at gcc dot gnu.org
2020-10-26 20:59 ` anlauf at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-24 21:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
--- Comment #2 from anlauf at gcc dot gnu.org ---
The patch
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index a210f9aad43..096108f4317 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -16476,6 +16507,7 @@ gfc_impure_variable (gfc_symbol *sym)
proc = sym->ns->proc_name;
if (sym->attr.dummy
+ && !sym->attr.value
&& ((proc->attr.subroutine && sym->attr.intent == INTENT_IN)
|| proc->attr.function))
return 1;
regtests fine. Not sure if this is the best solution, since older
Fortran standards seemed to require INTENT(IN) for dummy x, while
F2018 forbids INTENT(INOUT) and INTENT(OUT), as well as ALLOCATABLE,
POINTER and VOLATILE here.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
2020-10-19 20:26 ` [Bug fortran/97491] " anlauf at gcc dot gnu.org
2020-10-24 21:00 ` anlauf at gcc dot gnu.org
@ 2020-10-26 20:59 ` anlauf at gcc dot gnu.org
2020-10-27 19:40 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-26 20:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
--- Comment #3 from anlauf at gcc dot gnu.org ---
Submitted here: https://gcc.gnu.org/pipermail/fortran/2020-October/055235.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
` (2 preceding siblings ...)
2020-10-26 20:59 ` anlauf at gcc dot gnu.org
@ 2020-10-27 19:40 ` cvs-commit at gcc dot gnu.org
2020-10-27 19:44 ` anlauf at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-27 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:a764c40079a493826a3678174f908941a383644e
commit r11-4459-ga764c40079a493826a3678174f908941a383644e
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Oct 27 20:25:23 2020 +0100
PR fortran/97491 - Wrong restriction for VALUE arguments of pure procedures
A dummy argument with the VALUE attribute may be redefined in a PURE or
ELEMENTAL procedure. Adjust the associated purity check.
gcc/fortran/ChangeLog:
* resolve.c (gfc_impure_variable): A dummy argument with the VALUE
attribute may be redefined without making a procedure impure.
gcc/testsuite/ChangeLog:
* gfortran.dg/value_8.f90: New test.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
` (3 preceding siblings ...)
2020-10-27 19:40 ` cvs-commit at gcc dot gnu.org
@ 2020-10-27 19:44 ` anlauf at gcc dot gnu.org
2020-11-03 22:01 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-27 19:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #5 from anlauf at gcc dot gnu.org ---
Fixed on master so far.
If there is no fallout, and if after some waiting time the patch still seems to
be safe, I'll consider to backport to 10-branch, as Paul mentioned on the ML.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
` (4 preceding siblings ...)
2020-10-27 19:44 ` anlauf at gcc dot gnu.org
@ 2020-11-03 22:01 ` cvs-commit at gcc dot gnu.org
2020-11-03 22:04 ` anlauf at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-03 22:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:a00894a3a3eb2852cd782a9cc6ee5bd83bfff542
commit r10-8970-ga00894a3a3eb2852cd782a9cc6ee5bd83bfff542
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Oct 27 20:25:23 2020 +0100
PR fortran/97491 - Wrong restriction for VALUE arguments of pure procedures
A dummy argument with the VALUE attribute may be redefined in a PURE or
ELEMENTAL procedure. Adjust the associated purity check.
gcc/fortran/ChangeLog:
* resolve.c (gfc_impure_variable): A dummy argument with the VALUE
attribute may be redefined without making a procedure impure.
gcc/testsuite/ChangeLog:
* gfortran.dg/value_8.f90: New test.
(cherry picked from commit a764c40079a493826a3678174f908941a383644e)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
` (5 preceding siblings ...)
2020-11-03 22:01 ` cvs-commit at gcc dot gnu.org
@ 2020-11-03 22:04 ` anlauf at gcc dot gnu.org
2021-03-16 13:16 ` burnus at gcc dot gnu.org
2021-03-20 20:22 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-11-03 22:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from anlauf at gcc dot gnu.org ---
Fixed on master for gcc-11 and on 10-branch. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
` (6 preceding siblings ...)
2020-11-03 22:04 ` anlauf at gcc dot gnu.org
@ 2021-03-16 13:16 ` burnus at gcc dot gnu.org
2021-03-20 20:22 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-16 13:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Boyce at engineer dot com
--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> ---
*** Bug 99609 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/97491] Wrong restriction for VALUE arguments of pure procedures
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
` (7 preceding siblings ...)
2021-03-16 13:16 ` burnus at gcc dot gnu.org
@ 2021-03-20 20:22 ` cvs-commit at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-20 20:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97491
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:e016c286dae10ea1b037d149fee924bdd07e546a
commit r9-9298-ge016c286dae10ea1b037d149fee924bdd07e546a
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Oct 27 20:25:23 2020 +0100
PR fortran/97491 - Wrong restriction for VALUE arguments of pure procedures
A dummy argument with the VALUE attribute may be redefined in a PURE or
ELEMENTAL procedure. Adjust the associated purity check.
gcc/fortran/ChangeLog:
* resolve.c (gfc_impure_variable): A dummy argument with the VALUE
attribute may be redefined without making a procedure impure.
gcc/testsuite/ChangeLog:
* gfortran.dg/value_8.f90: New test.
(cherry picked from commit a764c40079a493826a3678174f908941a383644e)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-03-20 20:22 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 12:40 [Bug fortran/97491] New: Wrong restriction for VALUE arguments of pure procedures tkoenig at gcc dot gnu.org
2020-10-19 20:26 ` [Bug fortran/97491] " anlauf at gcc dot gnu.org
2020-10-24 21:00 ` anlauf at gcc dot gnu.org
2020-10-26 20:59 ` anlauf at gcc dot gnu.org
2020-10-27 19:40 ` cvs-commit at gcc dot gnu.org
2020-10-27 19:44 ` anlauf at gcc dot gnu.org
2020-11-03 22:01 ` cvs-commit at gcc dot gnu.org
2020-11-03 22:04 ` anlauf at gcc dot gnu.org
2021-03-16 13:16 ` burnus at gcc dot gnu.org
2021-03-20 20:22 ` cvs-commit at gcc dot gnu.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).