public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute
@ 2006-03-03 19:50 bdtaylo1 at uiuc dot edu
2006-03-03 20:00 ` [Bug fortran/26551] " pinskia at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: bdtaylo1 at uiuc dot edu @ 2006-03-03 19:50 UTC (permalink / raw)
To: gcc-bugs
A subroutine or function that calls itself recursively must be declared with
the RECURSIVE attribute. gfortran should refuse to compile the subroutine
below and return an error indicating that the RECURSIVE attribute must be
specified.
>$ cat sub.f90
SUBROUTINE SUB()
CALL SUB()
END SUBROUTINE
>$ gfortran -std=f95 -pedantic sub.f90 -c
>$ gfortran -c -v
Using built-in specs.
Target: powerpc-apple-darwin8.1.0
Configured with: ../gcc-4.1-20050611/configure --enable-threads=posix
--enable-languages=c++,f95
Thread model: posix
gcc version 4.1.0 20050611 (experimental)
For comparison, here is output from g95 and xlf90:
>$ g95 -std=f95 -pedantic sub.f90 -c
In file sub.f90:2
CALL SUB()
1
Error: SUBROUTINE 'sub' at (1) must be RECURSIVE in order to call itself
>$ xlf90 -qsuffix=cpp=f90 -f95 sub.f90 -c
"sub.f90", line 2.6: 1513-126 (S) Recursive calls are only permitted when the
RECUR option is specified or the RECURSIVE keyword is specified.
** sub === End of Compilation 1 ===
1501-511 Compilation failed for file sub.f90.
On a related note, the limitations on RECURSIVE subroutines and functions
should also be extended to any ENTRY statements within the subprogram. For
example, the following code is also illegal but gfortran currently accepts it:
>$ cat sub2.f90
SUBROUTINE SUB2()
ENTRY ENT2()
CALL ENT2()
END SUBROUTINE
>$ gfortran -std=f95 -pedantic sub2.f90 -c
For comparison, xlf has the following output:
>$ xlf90 -qsuffix=cpp=f90 -f95 sub2.f90 -c
"sub2.f90", line 3.6: 1513-126 (S) Recursive calls are only permitted when the
RECUR option is specified or the RECURSIVE keyword is specified.
** sub2 === End of Compilation 1 ===
1501-511 Compilation failed for file sub2.f90.
--
Summary: gfortran compiles recursive subroutines declared without
the RECURSIVE attribute
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bdtaylo1 at uiuc dot edu
GCC build triplet: powerpc-apple-darwin8.1.0
GCC host triplet: powerpc-apple-darwin8.1.0
GCC target triplet: powerpc-apple-darwin8.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/26551] gfortran compiles recursive subroutines declared without the RECURSIVE attribute
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
@ 2006-03-03 20:00 ` pinskia at gcc dot gnu dot org
2006-03-03 20:02 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-03 20:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-03-03 20:00 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
GCC build triplet|powerpc-apple-darwin8.1.0 |
GCC host triplet|powerpc-apple-darwin8.1.0 |
GCC target triplet|powerpc-apple-darwin8.1.0 |
Keywords| |accepts-invalid
Last reconfirmed|0000-00-00 00:00:00 |2006-03-03 20:00:33
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/26551] gfortran compiles recursive subroutines declared without the RECURSIVE attribute
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
2006-03-03 20:00 ` [Bug fortran/26551] " pinskia at gcc dot gnu dot org
@ 2006-03-03 20:02 ` pinskia at gcc dot gnu dot org
2006-03-03 21:05 ` bdtaylo1 at uiuc dot edu
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-03 20:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-03-03 20:02 -------
g77 errored out:
[dandelion:~] pinskia% /Volumes/home/pinskia/gcc-3.3/bin/g77 t.f -ffree-form
t.f: In subroutine `sub':
t.f:1:
SUBROUTINE SUB()
1
t.f:2: (continued):
CALL SUB()
2
Invalid declaration of or reference to symbol `sub' at (2) [initially seen at
(1)]
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |19292
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/26551] gfortran compiles recursive subroutines declared without the RECURSIVE attribute
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
2006-03-03 20:00 ` [Bug fortran/26551] " pinskia at gcc dot gnu dot org
2006-03-03 20:02 ` pinskia at gcc dot gnu dot org
@ 2006-03-03 21:05 ` bdtaylo1 at uiuc dot edu
2006-05-07 11:08 ` fxcoudert at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bdtaylo1 at uiuc dot edu @ 2006-03-03 21:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from bdtaylo1 at uiuc dot edu 2006-03-03 21:05 -------
The second example (involving a recursive call to an ENTRY statement) also
errors out on g77 (v3.4.4):
>$ g77 -ffree-form sub2.f -c
sub2.f: In subroutine `sub2':
sub2.f:2:
ENTRY ENT2()
1
sub2.f:3: (continued):
CALL ENT2()
2
Invalid declaration of or reference to symbol `ent2' at (2) [initially seen at
(1)]
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/26551] gfortran compiles recursive subroutines declared without the RECURSIVE attribute
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
` (2 preceding siblings ...)
2006-03-03 21:05 ` bdtaylo1 at uiuc dot edu
@ 2006-05-07 11:08 ` fxcoudert at gcc dot gnu dot org
2006-05-17 14:12 ` fxcoudert at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-07 11:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2006-05-07 11:08 -------
Patch proposed here: http://gcc.gnu.org/ml/fortran/2006-05/msg00108.html
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
URL| |http://gcc.gnu.org/ml/fortra
| |n/2006-05/msg00108.html
Status|NEW |ASSIGNED
Keywords| |patch
Last reconfirmed|2006-03-03 20:00:33 |2006-05-07 11:08:22
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/26551] gfortran compiles recursive subroutines declared without the RECURSIVE attribute
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
` (3 preceding siblings ...)
2006-05-07 11:08 ` fxcoudert at gcc dot gnu dot org
@ 2006-05-17 14:12 ` fxcoudert at gcc dot gnu dot org
2006-05-17 14:15 ` fxcoudert at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-17 14:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from fxcoudert at gcc dot gnu dot org 2006-05-17 14:11 -------
Subject: Bug 26551
Author: fxcoudert
Date: Wed May 17 14:11:40 2006
New Revision: 113860
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113860
Log:
PR fortran/26551
* resolve.c (resolve_call, resolve_function): Issue an error
if a function or subroutine call is recursive but the function or
subroutine wasn't declared as such.
* gfortran.dg/recursive_check_1.f: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/recursive_check_1.f
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/26551] gfortran compiles recursive subroutines declared without the RECURSIVE attribute
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
` (4 preceding siblings ...)
2006-05-17 14:12 ` fxcoudert at gcc dot gnu dot org
@ 2006-05-17 14:15 ` fxcoudert at gcc dot gnu dot org
2006-05-27 9:06 ` [Bug fortran/26551] [4.1 only] " fxcoudert at gcc dot gnu dot org
2006-05-27 9:07 ` [Bug fortran/26551] " fxcoudert at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-17 14:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from fxcoudert at gcc dot gnu dot org 2006-05-17 14:15 -------
Subject: Bug 26551
Author: fxcoudert
Date: Wed May 17 14:14:56 2006
New Revision: 113861
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113861
Log:
Testcase forgotten in the previous commit.
PR fortran/26551
* gfortran.dg/recursive_check_2.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/recursive_check_2.f90
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/26551] [4.1 only] gfortran compiles recursive subroutines declared without the RECURSIVE attribute
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
` (5 preceding siblings ...)
2006-05-17 14:15 ` fxcoudert at gcc dot gnu dot org
@ 2006-05-27 9:06 ` fxcoudert at gcc dot gnu dot org
2006-05-27 9:07 ` [Bug fortran/26551] " fxcoudert at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-27 9:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from fxcoudert at gcc dot gnu dot org 2006-05-27 09:06 -------
Subject: Bug 26551
Author: fxcoudert
Date: Sat May 27 09:06:01 2006
New Revision: 114152
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114152
Log:
Backports from mainline
PR fortran/27552
* dump-parse-tree.c (gfc_show_expr): Deal with Hollerith constants.
* data.c (create_character_intializer): Set from_H flag if character is
initialized by Hollerith constant.
PR fortran/27320
* dump-parse-tree.c (gfc_show_code_node): Try harder to find the
called procedure name.
PR fortran/26551
* resolve.c (resolve_call, resolve_function): Issue an error
if a function or subroutine call is recursive but the function or
subroutine wasn't declared as such.
* gfortran.dg/recursive_check_1.f: New test.
* gfortran.dg/recursive_check_2.f90: New test.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/recursive_check_1.f
- copied unchanged from r113861,
trunk/gcc/testsuite/gfortran.dg/recursive_check_1.f
branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/recursive_check_2.f90
- copied unchanged from r113861,
trunk/gcc/testsuite/gfortran.dg/recursive_check_2.f90
Modified:
branches/gcc-4_1-branch/gcc/fortran/ChangeLog
branches/gcc-4_1-branch/gcc/fortran/data.c
branches/gcc-4_1-branch/gcc/fortran/dump-parse-tree.c
branches/gcc-4_1-branch/gcc/fortran/resolve.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/26551] gfortran compiles recursive subroutines declared without the RECURSIVE attribute
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
` (6 preceding siblings ...)
2006-05-27 9:06 ` [Bug fortran/26551] [4.1 only] " fxcoudert at gcc dot gnu dot org
@ 2006-05-27 9:07 ` fxcoudert at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2006-05-27 9:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from fxcoudert at gcc dot gnu dot org 2006-05-27 09:07 -------
Fixed on mainline and 4.1.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to fail|4.1.1 |
Known to work|4.2.0 |4.2.0 4.1.2
Resolution| |FIXED
Summary|[4.1 only] gfortran compiles|gfortran compiles recursive
|recursive subroutines |subroutines declared without
|declared without the |the RECURSIVE attribute
|RECURSIVE attribute |
Target Milestone|--- |4.1.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26551
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-05-27 9:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-03 19:50 [Bug fortran/26551] New: gfortran compiles recursive subroutines declared without the RECURSIVE attribute bdtaylo1 at uiuc dot edu
2006-03-03 20:00 ` [Bug fortran/26551] " pinskia at gcc dot gnu dot org
2006-03-03 20:02 ` pinskia at gcc dot gnu dot org
2006-03-03 21:05 ` bdtaylo1 at uiuc dot edu
2006-05-07 11:08 ` fxcoudert at gcc dot gnu dot org
2006-05-17 14:12 ` fxcoudert at gcc dot gnu dot org
2006-05-17 14:15 ` fxcoudert at gcc dot gnu dot org
2006-05-27 9:06 ` [Bug fortran/26551] [4.1 only] " fxcoudert at gcc dot gnu dot org
2006-05-27 9:07 ` [Bug fortran/26551] " fxcoudert 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).