public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32936] New: Error: STAT expression ... must be a variable - but it is
@ 2007-07-30 15:09 flad at gmx dot at
2007-07-30 15:45 ` [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one burnus at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: flad at gmx dot at @ 2007-07-30 15:09 UTC (permalink / raw)
To: gcc-bugs
The following testcase produces an error:
--------------------------------------------------------
function all_res()
implicit none
real, pointer :: gain
integer :: all_res
allocate (gain,STAT=all_res)
end
--------------------------------------------------------
--------------------------------------------------------
gfortran -c test_gfortran3.f90
test_gfortran3.f90:8.27:
allocate (gain,STAT=all_res)
1
Error: STAT expression at (1) must be a variable
--------------------------------------------------------
Tried with gfortran 4.2.1 and r127057. NAG and Lahey compiler work with this
code. Platform i686, Debian lenny.
--
Summary: Error: STAT expression ... must be a variable - but it
is
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: flad at gmx dot at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32936
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one
2007-07-30 15:09 [Bug fortran/32936] New: Error: STAT expression ... must be a variable - but it is flad at gmx dot at
@ 2007-07-30 15:45 ` burnus at gcc dot gnu dot org
2007-07-30 18:31 ` patchapp at dberlin dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-07-30 15:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2007-07-30 15:45 -------
The problem is that "all_res" is not only the name of a (result) variable but
also of the function itself.
The following - not regtested - should work (also if one uses ENTRY rather than
FUNCTION).
Index: gcc/fortran/match.c
===================================================================
--- gcc/fortran/match.c (Revision 127062)
+++ gcc/fortran/match.c (Arbeitskopie)
@@ -2015,7 +2015,9 @@ gfc_match_allocate (void)
goto cleanup;
}
- if (stat->symtree->n.sym->attr.flavor != FL_VARIABLE)
+ if (stat->symtree->n.sym->attr.flavor != FL_VARIABLE
+ && (!stat->symtree->n.sym->attr.function
+ || stat->symtree->n.sym->result != stat->symtree->n.sym))
{
gfc_error ("STAT expression at %C must be a variable");
goto cleanup;
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |rejects-valid
Known to fail| |4.3.0 4.2.2 4.1.3
Last reconfirmed|0000-00-00 00:00:00 |2007-07-30 15:45:12
date| |
Summary|Error: STAT expression ... |ALLOCATE: "STAT expression
|must be a variable - but it |... must be a variable" -
|is |but it is one
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32936
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one
2007-07-30 15:09 [Bug fortran/32936] New: Error: STAT expression ... must be a variable - but it is flad at gmx dot at
2007-07-30 15:45 ` [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one burnus at gcc dot gnu dot org
@ 2007-07-30 18:31 ` patchapp at dberlin dot org
2007-07-31 13:02 ` dominiq at lps dot ens dot fr
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2007-07-30 18:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from patchapp at dberlin dot org 2007-07-30 18:30 -------
Subject: Bug number PR32936
A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg02125.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32936
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one
2007-07-30 15:09 [Bug fortran/32936] New: Error: STAT expression ... must be a variable - but it is flad at gmx dot at
2007-07-30 15:45 ` [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one burnus at gcc dot gnu dot org
2007-07-30 18:31 ` patchapp at dberlin dot org
@ 2007-07-31 13:02 ` dominiq at lps dot ens dot fr
2007-08-01 17:55 ` burnus at gcc dot gnu dot org
2007-08-01 18:01 ` burnus at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-07-31 13:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from dominiq at lps dot ens dot fr 2007-07-31 13:01 -------
> A patch for this bug has been added to the patch tracker.
Regtested on PPC Darwin8.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32936
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one
2007-07-30 15:09 [Bug fortran/32936] New: Error: STAT expression ... must be a variable - but it is flad at gmx dot at
` (2 preceding siblings ...)
2007-07-31 13:02 ` dominiq at lps dot ens dot fr
@ 2007-08-01 17:55 ` burnus at gcc dot gnu dot org
2007-08-01 18:01 ` burnus at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-01 17:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from burnus at gcc dot gnu dot org 2007-08-01 17:55 -------
Subject: Bug 32936
Author: burnus
Date: Wed Aug 1 17:55:24 2007
New Revision: 127135
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127135
Log:
2007-08-01 Tobias Burnus <burnus@net-b.de>
PR fortran/32936
* match.c (gfc_match_allocate): Better check that STAT is
a variable.
* check.c (gfc_check_allocated): Reorder checks to improve
error message.
2007-08-01 Tobias Burnus <burnus@net-b.de>
PR fortran/32936
* gfortran.dg/allocate_stat.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/allocate_stat.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/check.c
trunk/gcc/fortran/match.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32936
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one
2007-07-30 15:09 [Bug fortran/32936] New: Error: STAT expression ... must be a variable - but it is flad at gmx dot at
` (3 preceding siblings ...)
2007-08-01 17:55 ` burnus at gcc dot gnu dot org
@ 2007-08-01 18:01 ` burnus at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-08-01 18:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from burnus at gcc dot gnu dot org 2007-08-01 18:00 -------
FIXED in GCC 4.3; as it is not regression [and no wrong-code bug either] I will
not backport it to 4.2.x or 4.1.x -> mark as fixed.
Note: GCC gfortran 4.3.0 nightly builds are e.g. available at
http://gcc.gnu.org/wiki/GFortranBinaries
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32936
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-08-01 18:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-30 15:09 [Bug fortran/32936] New: Error: STAT expression ... must be a variable - but it is flad at gmx dot at
2007-07-30 15:45 ` [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one burnus at gcc dot gnu dot org
2007-07-30 18:31 ` patchapp at dberlin dot org
2007-07-31 13:02 ` dominiq at lps dot ens dot fr
2007-08-01 17:55 ` burnus at gcc dot gnu dot org
2007-08-01 18:01 ` burnus 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).