Discussion:
[Fortran, Patch] Implement IMPLICIT NONE
Tobias Burnus
2014-10-01 22:32:26 UTC
Permalink
I don't want to implement Fortran 90's implicit none, which is of course
already supported. However, I would like to implement as vendor extension:

IMPLICIT NONE (external)

which forces at that least an "external" or "procedure" is used or an
explicit interface available, if one tries to invoke a procedure.
Background for the change is my recent bug:
internal co_broadcast
call co_broadcasr(...)

While I have implemented is as vendor extension (-std=gnu), of course,
the syntax doesn't come out of the blue but is in the current Fortran
2015 draft (14-007r2):

R563 implicit-stmt is IMPLICIT implicit-spec-list
or IMPLICIT NONE [ ( [ implicit-none-spec-list ] ) ]
R566 implicit-none-spec is EXTERNAL
or TYPE


Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias
Tobias Burnus
2014-10-01 22:35:47 UTC
Permalink
Post by Tobias Burnus
IMPLICIT NONE (external)
While I have implemented is as vendor extension (-std=gnu)
Ups, I forgot to include the gcc/fortran/libgfortran.h change in the
patch. See updated attachment.
Post by Tobias Burnus
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Tobias
FX
2014-10-04 09:27:30 UTC
Permalink
Post by Tobias Burnus
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Looks mostly OK, but I have one question: I don’t understand what the wording "Type IMPLICIT NONE statement” is supposed to mean. Why “type”?

FX
Tobias Burnus
2014-10-04 09:42:51 UTC
Permalink
Post by FX
Post by Tobias Burnus
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Looks mostly OK, but I have one question: I don’t understand what the wording "Type IMPLICIT NONE statement” is supposed to mean. Why “type”?
Well, I want to distinguish "IMPLICIT NONE (external)" which only
applies to procedures from "IMPLICIT NONE" alias "IMPLICIT NONE (type)"
which applies only to variables and function (return value) types. Thus,
IMPLICIT NONE (external)
IMPLICIT integer(a-z)
is valid while
IMPLICIT NONE
IMPLICIT integer(a-z)
is not.

If you have a better suggestion for the wording …

Tobias
FX
2014-10-04 09:53:44 UTC
Permalink
Post by Tobias Burnus
If you have a better suggestion for the wording …
I’d suggest “IMPLICIT NONE (TYPE) statement at %C following an IMPLICIT statement” (and the other way around).

OK, with or without the wording change, I let you decide
Marek Polacek
2014-10-06 07:13:58 UTC
Permalink
Post by Tobias Burnus
IMPLICIT NONE (external)
While I have implemented is as vendor extension (-std=gnu)
Ups, I forgot to include the gcc/fortran/libgfortran.h change in the patch.
See updated attachment.
Seems that gcc/fortran/libgfortran.h part is not committed, after
r215914 I get

gcc/fortran/decl.c:2960:28: error: ‘GFC_STD_F2015’ was not declared in this scope
if (!gfc_notify_std (GFC_STD_F2015, "IMPORT NONE with spec list at %C"))
^
make[2]: *** [fortran/decl.o] Error 1

Marek
Tobias Burnus
2014-10-06 07:20:50 UTC
Permalink
Hi Marek, hi all,
Post by Marek Polacek
Seems that gcc/fortran/libgfortran.h part is not committed, after
r215914 I get
gcc/fortran/decl.c:2960:28: error: âGFC_STD_F2015â was not declared in this scope
Committing patches when having a cold doesn't seem to work. I don't have
access to the computer with SVN write permission, thus, I cannot fix it myself before
this evening.

Can someone commit the patch for me? It's the first chunk (= gcc/fortran/libgfortran.h)
at https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00105.html

Thanks - and sorry for the breakage!

Tobias
Marek Polacek
2014-10-06 07:30:59 UTC
Permalink
Hi,
Post by Tobias Burnus
Committing patches when having a cold doesn't seem to work. I don't have
Having fight with cold last week, I know what you're talking about ;).
Post by Tobias Burnus
access to the computer with SVN write permission, thus, I cannot fix it myself before
this evening.
Can someone commit the patch for me? It's the first chunk (= gcc/fortran/libgfortran.h)
at https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00105.html
Sure, I'll commit it.

Marek
Andreas Schwab
2014-10-07 18:16:39 UTC
Permalink
diff --git a/gcc/testsuite/gfortran.dg/implicit_4.f90 b/gcc/testsuite/gfortran.dg/implicit_4.f90
index 2e871b0..9bf8d86 100644
--- a/gcc/testsuite/gfortran.dg/implicit_4.f90
+++ b/gcc/testsuite/gfortran.dg/implicit_4.f90
@@ -5,13 +5,13 @@ IMPLICIT NONE ! { dg-error "Duplicate" }
END
SUBROUTINE a
-IMPLICIT REAL(b-j) ! { dg-error "cannot follow" }
-implicit none ! { dg-error "cannot follow" }
+IMPLICIT REAL(b-j)
+implicit none ! { dg-error "Type IMPLICIT NONE statement at .1. following an IMPLICIT statement" }
That doesn't match.

/usr/local/gcc/gcc-20141007/gcc/testsuite/gfortran.dg/implicit_4.f90:9:103: Err\or: IMPLICIT NONE (type) statement at (1) following an IMPLICIT statement

Andreas.
--
Andreas Schwab, ***@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Dominique Dhumieres
2014-10-07 22:33:42 UTC
Permalink
Patch:

--- ../_clean/gcc/testsuite/gfortran.dg/implicit_4.f90 2014-10-07 00:21:56.000000000 +0200
+++ gcc/testsuite/gfortran.dg/implicit_4.f90 2014-10-07 19:09:45.000000000 +0200
@@ -6,7 +6,7 @@ END

SUBROUTINE a
IMPLICIT REAL(b-j)
-implicit none ! { dg-error "Type IMPLICIT NONE statement at .1. following an IMPLICIT statement" }
+implicit none ! { dg-error "IMPLICIT NONE .type. statement at .1. following an IMPLICIT statement" }
END SUBROUTINE a

subroutine b

Note that the loci are badly placed:

/opt/gcc/work/gcc/testsuite/gfortran.dg/implicit_4.f90:4.40:

IMPLICIT NONE ! { dg-error "Duplicate" }
1
Error: Duplicate IMPLICIT NONE statement at (1)
/opt/gcc/work/gcc/testsuite/gfortran.dg/implicit_4.f90:9.105:

r "IMPLICIT NONE .type. statement at .1. following an IMPLICIT statement" }
1
Error: IMPLICIT NONE (type) statement at (1) following an IMPLICIT statement
/opt/gcc/work/gcc/testsuite/gfortran.dg/implicit_4.f90:14.8:

implicit real(g-k) ! { dg-error "IMPLICIT statement at .1. following an IMPLICI
1
Error: IMPLICIT statement at (1) following an IMPLICIT NONE (type) statement
/opt/gcc/work/gcc/testsuite/gfortran.dg/implicit_4.f90:19.47:

implicit integer (b-c) ! { dg-error "already" }
1
Error: Letter B already has an IMPLICIT type at (1)
/opt/gcc/work/gcc/testsuite/gfortran.dg/implicit_4.f90:20.57:

implicit real(d-f), complex(f-g) ! { dg-error "already" }
1
Error: Letter F already has an IMPLICIT type at (1)

i.e., at the end of the comment and not where the error occurs.

Dominique
FX
2014-10-08 07:22:16 UTC
Permalink
Patch
Patch cleaning up the testsuite (while Tobias is curing is cold :) is pre-approved.
It comes from the last-minute wording change I suggested, I suppose.

FX
Dominique d'Humières
2014-10-08 21:56:42 UTC
Permalink
This is what I have committed as r216016

Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 216014)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2014-10-08 Dominique d'Humieres <***@lps.ens.fr>
+
+ * gfortran.dg/implicit_4.f90: Fix some dg-error.
+
2014-10-08 Rainer Orth <***@CeBiTec.Uni-Bielefeld.DE>

* gcc.dg/torture/stackalign/builtin-apply-4.c: Use
@@ -4213,7 +4217,7 @@
2014-07-09 Dominique d'Humieres <***@lps.ens.fr>

PR testsuite/61453
- * gfortran.dg/gfortran.dg/bind_c_array_params_2.f90:
+ * gfortran.dg/bind_c_array_params_2.f90:
Adjust regexp for more targets.

2014-07-09 Andrew Sutton <***@gmail.com>
@@ -6258,9 +6262,9 @@

2014-05-24 Dominique d'Humieres <***@lps.ens.fr>

- * gfortran.dg/gfortran.dg/bind_c_array_params_2.f90:
+ * gfortran.dg/bind_c_array_params_2.f90:
Adjust regexp for -flto.
- * gfortran.dg/gfortran.dg/pr48636-2.f90: Likewise.
+ * gfortran.dg/pr48636-2.f90: Likewise.
* gfortran.dg/pr52835.f90: Likewise.

2014-05-23 Vladimir Makarov <***@redhat.com>
Index: gcc/testsuite/gfortran.dg/implicit_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/implicit_4.f90 (revision 216014)
+++ gcc/testsuite/gfortran.dg/implicit_4.f90 (working copy)
@@ -6,7 +6,7 @@

SUBROUTINE a
IMPLICIT REAL(b-j)
-implicit none ! { dg-error "Type IMPLICIT NONE statement at .1. following an IMPLICIT statement" }
+implicit none ! { dg-error "IMPLICIT NONE .type. statement at .1. following an IMPLICIT statement" }
END SUBROUTINE a

subroutine b

Dominique
Post by FX
Patch
Patch cleaning up the testsuite (while Tobias is curing is cold :) is pre-approved.
It comes from the last-minute wording change I suggested, I suppose.
FX
Loading...