public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
@ 2007-05-18 11:47 ` dfranke at gcc dot gnu dot org
2007-05-19 2:47 ` jvdelisle at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-18 11:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dfranke at gcc dot gnu dot org 2007-05-18 12:46 -------
F95, section 12.3.2.3, INTRINSIC statement:
R1209 intrinsic-stmt is INTRINSIC [ :: ] intrinsic-procedure-name-list
Constraint: Each intrinsic-procedure-name shall be the name of an intrinsic
procedure.
This doesn't mention any types at all. In addition, only SUN warns about a
superfluous type here:
$> ifort -warn all pr20373.f90 # no message
$> sunf95 -w3 pr20373.f90
integer, intrinsic :: dsqrt
^
"pr20373.f90", Line = 1, Column = 23: CAUTION: The type statement for generic
intrinsic function DSQRT is ignored.
Following this, following patch emits a warning if std=gnu and an error if
std=f95|f2203 (not regtested). The wording of the msg could be improved ...
Index: resolve.c
===================================================================
--- resolve.c (revision 124790)
+++ resolve.c (working copy)
@@ -6400,6 +6400,12 @@
&& !gfc_intrinsic_name(sym->name, 1))
gfc_error("Intrinsic at %L does not exist", &sym->declared_at);
+ /* Due to F95, 12.3.2.3, INTRINSIC statements shall have no type. */
+ if (sym->attr.intrinsic && sym->ts.type != BT_UNKNOWN)
+ gfc_notify_std(GFC_STD_LEGACY | GFC_STD_GNU,
+ "Intrinsic at %L shall not have a type specifier",
+ &sym->declared_at);
+
/* Resolve array specifier. Check as well some constraints
on COMMON blocks. */
$> gfortran-svn -g -Wall -std=gnu pr20373.f90
pr20373.f90:1.27:
integer, intrinsic :: dsqrt
1
Warning: Intrinsic at (1) shall not have a type specifier
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dfranke at gcc dot gnu dot
| |org
Keywords| |diagnostic, patch
Known to fail| |4.2.1 4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
2007-05-18 11:47 ` [Bug fortran/20373] INTRINSIC symbols can be given the wrong type dfranke at gcc dot gnu dot org
@ 2007-05-19 2:47 ` jvdelisle at gcc dot gnu dot org
2007-05-19 8:14 ` dfranke at gcc dot gnu dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-05-19 2:47 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jvdelisle at gcc dot gnu dot org 2007-05-19 03:47 -------
This patch looks simple enough. Has it been regression tested? Anything else
planned with this?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
2007-05-18 11:47 ` [Bug fortran/20373] INTRINSIC symbols can be given the wrong type dfranke at gcc dot gnu dot org
2007-05-19 2:47 ` jvdelisle at gcc dot gnu dot org
@ 2007-05-19 8:14 ` dfranke at gcc dot gnu dot org
2007-05-19 9:51 ` tobi at gcc dot gnu dot org
` (9 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-19 8:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from dfranke at gcc dot gnu dot org 2007-05-19 09:14 -------
> This patch looks simple enough. Has it been regression tested?
> Anything else planned with this?
Getting rid of it? I spent the last evening regtesting and failed. In the same
routine where I placed above snippet, everything without a type is assigned a
type, this includes intrinsics. If the if-clause is adjusted to not apply
default types to intrinsics, I still get a failure in the testsuite
(gomp/reduction3.f90) which I can not eliminate.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2007-05-19 8:14 ` dfranke at gcc dot gnu dot org
@ 2007-05-19 9:51 ` tobi at gcc dot gnu dot org
2007-05-19 10:13 ` dfranke at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: tobi at gcc dot gnu dot org @ 2007-05-19 9:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from tobi at gcc dot gnu dot org 2007-05-19 10:51 -------
(In reply to comment #4)
> F95, section 12.3.2.3, INTRINSIC statement:
> R1209 intrinsic-stmt is INTRINSIC [ :: ] intrinsic-procedure-name-list
> Constraint: Each intrinsic-procedure-name shall be the name of an intrinsic
> procedure.
>
> This doesn't mention any types at all. In addition, only SUN warns about a
> superfluous type here:
Please look in the place I quoted. I don't have the F95 standard handy, and I
couldn't find the corresponding rule in F2K, but I believe that I didn't invent
language rules :-)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2007-05-19 9:51 ` tobi at gcc dot gnu dot org
@ 2007-05-19 10:13 ` dfranke at gcc dot gnu dot org
2007-05-19 10:22 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
` (7 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-19 10:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from dfranke at gcc dot gnu dot org 2007-05-19 11:12 -------
Tobi, currently intrinsics don't start with any type at all. As their symbols
are processed in resolve.c (resolve_symbol), they are assigned a default type:
/* Assign default type to symbols that need one and don't have one. */
As shown by gfc_show_symbol():
symbol conjg (UNKNOWN 0)(PROCEDURE UNKNOWN-INTENT UNKNOWN-ACCESS
UNKNOWN-PROC INTRINSIC FUNCTION)
result: conjg
symbol conjg (REAL 4)(PROCEDURE UNKNOWN-INTENT UNKNOWN-ACCESS
UNKNOWN-PROC INTRINSIC FUNCTION IMPLICIT-TYPE)
result: conjg
(the correct type for CONJG would be COMPLEX 4)
Thus, we should make sure that each intrinsic starts with the correct type to
begin with and emit a warning/error if someone attempts to change that type
(wherever the right place for this may be)?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2007-05-19 10:13 ` dfranke at gcc dot gnu dot org
@ 2007-05-19 10:22 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-05-31 8:05 ` dfranke at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: Tobias dot Schlueter at physik dot uni-muenchen dot de @ 2007-05-19 10:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from Tobias dot Schlueter at physik dot uni-muenchen dot de 2007-05-19 11:22 -------
Subject: Re: INTRINSIC symbols can be given the wrong
type
dfranke at gcc dot gnu dot org wrote:
> Thus, we should make sure that each intrinsic starts with the correct type to
> begin with and emit a warning/error if someone attempts to change that type
> (wherever the right place for this may be)?
The idea is probably that giving all intrinsics types right from the
beginning would be unnecessarily blowing up namespaces, and therefore
memory and compile-time consumption (and maybe module files)
What one can possibly do, though it might require quite a bit of care,
is modifying variable_decl() to check if the symbol is an intrinsic
declared with the correct type before adding it to the namespace.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2007-05-19 10:22 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
@ 2007-05-31 8:05 ` dfranke at gcc dot gnu dot org
2007-05-31 8:32 ` burnus at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-05-31 8:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from dfranke at gcc dot gnu dot org 2007-05-31 08:04 -------
*** Bug 32159 has been marked as a duplicate of this bug. ***
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2007-05-31 8:05 ` dfranke at gcc dot gnu dot org
@ 2007-05-31 8:32 ` burnus at gcc dot gnu dot org
2007-06-17 21:26 ` dfranke at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-05-31 8:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from burnus at gcc dot gnu dot org 2007-05-31 08:32 -------
Other compilers give only a warning.
NAG f95 does for:
integer :: len
intrinsic len
Warning: yy.f90, line 9: Intrinsic function LEN explicitly typed
and for
real :: len
intrinsic len
Warning: yy.f90, line 9: Type declaration for generic intrinsic LEN ignored
I think it makes sense to have the first warning always shown. For the second
one, maybe it should only be shown using some -W* ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2007-05-31 8:32 ` burnus at gcc dot gnu dot org
@ 2007-06-17 21:26 ` dfranke at gcc dot gnu dot org
2007-06-18 8:00 ` patchapp at dberlin dot org
` (3 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-17 21:26 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from dfranke at gcc dot gnu dot org 2007-06-17 21:26 -------
Forget the attempt to correct this given in comment #4.
Got something more useful :)
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |dfranke at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Keywords|patch |
Last reconfirmed|2005-12-30 19:11:01 |2007-06-17 21:26:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2007-06-17 21:26 ` dfranke at gcc dot gnu dot org
@ 2007-06-18 8:00 ` patchapp at dberlin dot org
2007-06-18 19:03 ` dfranke at gcc dot gnu dot org
` (2 subsequent siblings)
12 siblings, 0 replies; 16+ messages in thread
From: patchapp at dberlin dot org @ 2007-06-18 8:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from patchapp at dberlin dot org 2007-06-18 08:00 -------
Subject: Bug number PR20373
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-06/msg01216.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2007-06-18 8:00 ` patchapp at dberlin dot org
@ 2007-06-18 19:03 ` dfranke at gcc dot gnu dot org
2007-06-30 16:27 ` dfranke at gcc dot gnu dot org
2007-06-30 16:30 ` dfranke at gcc dot gnu dot org
12 siblings, 0 replies; 16+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-18 19:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from dfranke at gcc dot gnu dot org 2007-06-18 19:02 -------
Updated patch.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2007-
| |06/msg01263.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (10 preceding siblings ...)
2007-06-18 19:03 ` dfranke at gcc dot gnu dot org
@ 2007-06-30 16:27 ` dfranke at gcc dot gnu dot org
2007-06-30 16:30 ` dfranke at gcc dot gnu dot org
12 siblings, 0 replies; 16+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-30 16:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from dfranke at gcc dot gnu dot org 2007-06-30 16:27 -------
Subject: Bug 20373
Author: dfranke
Date: Sat Jun 30 16:26:55 2007
New Revision: 126153
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126153
Log:
gcc/fortran:
2007-06-30 Daniel Franke <franke.daniel@gmail.com>
PR fortran/20373
* intrinsic.c (add_functions): Additional function types.
(gfc_convert_type_warn): Remove intrinsic-flag from conversion
functions.
* resolve.c (resolve_symbol): Added type checks to explicitly defined
intrinsics.
gcc/testsuite:
2007-06-28 Daniel Franke <franke.daniel@gmail.com>
PR fortran/20373
* gfortran.dg/intrinsic.f90: New test.
Added:
trunk/gcc/testsuite/gfortran.dg/intrinsic.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/intrinsic.c
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
` (11 preceding siblings ...)
2007-06-30 16:27 ` dfranke at gcc dot gnu dot org
@ 2007-06-30 16:30 ` dfranke at gcc dot gnu dot org
12 siblings, 0 replies; 16+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2007-06-30 16:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from dfranke at gcc dot gnu dot org 2007-06-30 16:30 -------
Fixed in trunk. Closing.
--
dfranke at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Known to fail|4.2.1 4.3.0 |4.2.1
Known to work| |4.3.0
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
2005-03-07 23:53 [Bug fortran/20373] New: " tobi at gcc dot gnu dot org
2005-03-07 23:56 ` [Bug fortran/20373] " pinskia at gcc dot gnu dot org
2005-03-08 0:11 ` tobi at gcc dot gnu dot org
@ 2005-04-08 20:55 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-08 20:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-08 20:55 -------
*** Bug 20869 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |jv244 at cam dot ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
2005-03-07 23:53 [Bug fortran/20373] New: " tobi at gcc dot gnu dot org
2005-03-07 23:56 ` [Bug fortran/20373] " pinskia at gcc dot gnu dot org
@ 2005-03-08 0:11 ` tobi at gcc dot gnu dot org
2005-04-08 20:55 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 16+ messages in thread
From: tobi at gcc dot gnu dot org @ 2005-03-08 0:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tobi at gcc dot gnu dot org 2005-03-08 00:11 -------
A remark: this doesn't lead to wrong code,
integer, intrinsic :: dsqrt
print *, dsqrt(4.d0)
end
prints the expected 2.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Bug fortran/20373] INTRINSIC symbols can be given the wrong type
2005-03-07 23:53 [Bug fortran/20373] New: " tobi at gcc dot gnu dot org
@ 2005-03-07 23:56 ` pinskia at gcc dot gnu dot org
2005-03-08 0:11 ` tobi at gcc dot gnu dot org
2005-04-08 20:55 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-07 23:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-07 23:56 -------
Confirmed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-03-07 23:56:25
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20373
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2007-06-30 16:30 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-20373-8513@http.gcc.gnu.org/bugzilla/>
2007-05-18 11:47 ` [Bug fortran/20373] INTRINSIC symbols can be given the wrong type dfranke at gcc dot gnu dot org
2007-05-19 2:47 ` jvdelisle at gcc dot gnu dot org
2007-05-19 8:14 ` dfranke at gcc dot gnu dot org
2007-05-19 9:51 ` tobi at gcc dot gnu dot org
2007-05-19 10:13 ` dfranke at gcc dot gnu dot org
2007-05-19 10:22 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2007-05-31 8:05 ` dfranke at gcc dot gnu dot org
2007-05-31 8:32 ` burnus at gcc dot gnu dot org
2007-06-17 21:26 ` dfranke at gcc dot gnu dot org
2007-06-18 8:00 ` patchapp at dberlin dot org
2007-06-18 19:03 ` dfranke at gcc dot gnu dot org
2007-06-30 16:27 ` dfranke at gcc dot gnu dot org
2007-06-30 16:30 ` dfranke at gcc dot gnu dot org
2005-03-07 23:53 [Bug fortran/20373] New: " tobi at gcc dot gnu dot org
2005-03-07 23:56 ` [Bug fortran/20373] " pinskia at gcc dot gnu dot org
2005-03-08 0:11 ` tobi at gcc dot gnu dot org
2005-04-08 20:55 ` pinskia 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).