public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/30239] New: duplicate data type assignment not detected
@ 2006-12-17 16:48 dfranke at gcc dot gnu dot org
2006-12-17 20:16 ` [Bug fortran/30239] " burnus at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2006-12-17 16:48 UTC (permalink / raw)
To: gcc-bugs
The Intel Fortan Compiler issues an error on the code below
INTEGER FUNCTION foo()
INTEGER :: foo
foo = 0
END FUNCTION
gfortran takes it without further notice. Letting "INTEGER :: foo" be "REAL ::
foo" gives "Error: Symbol 'foo' at (1) already has basic type of INTEGER" on
gfortran as well.
$> gfortran-svn -v
gcc version 4.3.0 20061128 (experimental)
--
Summary: duplicate data type assignment not detected
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dfranke at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
@ 2006-12-17 20:16 ` burnus at gcc dot gnu dot org
2006-12-18 6:02 ` pault at gcc dot gnu dot org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-12-17 20:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2006-12-17 20:15 -------
This is because in symbol.c's gfc_add_type there is
const char *msg = "Symbol '%s' at %L already has basic type of %s";
if (!(sym->ts.type == ts->typesym->ts.type == ts->type
&& (sym->attr.flavor == FL_PROCEDURE || sym->attr.result))
|| gfc_notification_std (GFC_STD_GNU) == ERROR
|| pedantic)
{
gfc_error (msg, sym->name, where, gfc_basic_typename (sym->ts.type));
return FAILURE;
}
The !(sym->ts.type == ts->type) prevents the error message. Removing this check
should all what is needed for this bug.
But this might break other cases were it is allowed. (I didn't check/though
about those, however).
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-12-17 20:15:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
2006-12-17 20:16 ` [Bug fortran/30239] " burnus at gcc dot gnu dot org
@ 2006-12-18 6:02 ` pault at gcc dot gnu dot org
2006-12-18 7:49 ` burnus at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-18 6:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pault at gcc dot gnu dot org 2006-12-18 06:01 -------
This was a fix for a PR about a year ago - the std=gnu is meant, obviously, to
enforce all versions of the standard on this. However, a number of other
compilers did/do permit this wrinkle on the standard and it even appears in one
of Meissner's examples.
> should all what is needed for this bug.
> But this might break other cases were it is allowed. (I didn't check/though
> about those, however).
>
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
2006-12-17 20:16 ` [Bug fortran/30239] " burnus at gcc dot gnu dot org
2006-12-18 6:02 ` pault at gcc dot gnu dot org
@ 2006-12-18 7:49 ` burnus at gcc dot gnu dot org
2006-12-18 8:20 ` dfranke at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2006-12-18 7:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2006-12-18 07:49 -------
> This was a fix for a PR about a year ago - the std=gnu is meant, obviously, to
> enforce all versions of the standard on this. However, a number of other
> compilers did/do permit this wrinkle on the standard and it even appears in one
> of Meissner's examples.
Thus: Should we warn? Give an error (as ifort, NAG f95 and g95 do)? Or keep the
status quo where an error is given only for -pedantic and -std=f95/f2003 ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-12-18 7:49 ` burnus at gcc dot gnu dot org
@ 2006-12-18 8:20 ` dfranke at gcc dot gnu dot org
2008-08-22 7:19 ` domob at gcc dot gnu dot org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2006-12-18 8:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dfranke at gcc dot gnu dot org 2006-12-18 08:20 -------
Ups, I didn't check with -pedantic or the -std options.
Since others treat it as an error, I think, a warning in -std=gnu should be the
very least.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-12-18 8:20 ` dfranke at gcc dot gnu dot org
@ 2008-08-22 7:19 ` domob at gcc dot gnu dot org
2008-08-22 11:41 ` domob at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-08-22 7:19 UTC (permalink / raw)
To: gcc-bugs
--
domob at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |domob at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2006-12-17 20:15:55 |2008-08-22 07:18:27
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
` (4 preceding siblings ...)
2008-08-22 7:19 ` domob at gcc dot gnu dot org
@ 2008-08-22 11:41 ` domob at gcc dot gnu dot org
2008-08-22 12:48 ` dfranke at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-08-22 11:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from domob at gcc dot gnu dot org 2008-08-22 11:40 -------
What's with this PR, do you have any decision? I'm not sure about a `fixed'
warning, as this seems to be not common with gfortran, right?
But I'd suggest maybe a -Wsurprising warning, so that at least -Wall will
notify about this thing together with -pedantic or -std=*. What do you think
about this?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
` (5 preceding siblings ...)
2008-08-22 11:41 ` domob at gcc dot gnu dot org
@ 2008-08-22 12:48 ` dfranke at gcc dot gnu dot org
2008-08-22 20:38 ` domob at gcc dot gnu dot org
2008-08-22 20:39 ` domob at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2008-08-22 12:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from dfranke at gcc dot gnu dot org 2008-08-22 12:46 -------
FUNCTION foo()
INTEGER :: foo
INTEGER :: foo
foo = 42
END FUNCTION
This is the same and I'd expect (at least) a warning here -- without -pedantic.
IMO, one should be warned (-Wsurpring/-Wall, no -pedantic, in any standard) if
the type is confirmed as shown above.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
` (6 preceding siblings ...)
2008-08-22 12:48 ` dfranke at gcc dot gnu dot org
@ 2008-08-22 20:38 ` domob at gcc dot gnu dot org
2008-08-22 20:39 ` domob at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-08-22 20:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from domob at gcc dot gnu dot org 2008-08-22 20:37 -------
Subject: Bug 30239
Author: domob
Date: Fri Aug 22 20:36:12 2008
New Revision: 139499
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=139499
Log:
2008-08-22 Daniel Kraft <d@domob.eu>
PR fortran/30239
* symbol.c (gfc_add_type): Warn on -Wsurprising if a function-result
type is re-declared but neither -pedantic nor -std=f* is given and so
this is no error.
* invoke.texi (-Wsurprising): Document this new behaviour.
Added:
trunk/gcc/testsuite/gfortran.dg/duplicate_type_1.f90
trunk/gcc/testsuite/gfortran.dg/duplicate_type_2.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/invoke.texi
trunk/gcc/fortran/symbol.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug fortran/30239] duplicate data type assignment not detected
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
` (7 preceding siblings ...)
2008-08-22 20:38 ` domob at gcc dot gnu dot org
@ 2008-08-22 20:39 ` domob at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-08-22 20:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from domob at gcc dot gnu dot org 2008-08-22 20:38 -------
I think we can fix this now, added a -Wsurprising warning.
--
domob at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30239
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-08-22 20:39 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-17 16:48 [Bug fortran/30239] New: duplicate data type assignment not detected dfranke at gcc dot gnu dot org
2006-12-17 20:16 ` [Bug fortran/30239] " burnus at gcc dot gnu dot org
2006-12-18 6:02 ` pault at gcc dot gnu dot org
2006-12-18 7:49 ` burnus at gcc dot gnu dot org
2006-12-18 8:20 ` dfranke at gcc dot gnu dot org
2008-08-22 7:19 ` domob at gcc dot gnu dot org
2008-08-22 11:41 ` domob at gcc dot gnu dot org
2008-08-22 12:48 ` dfranke at gcc dot gnu dot org
2008-08-22 20:38 ` domob at gcc dot gnu dot org
2008-08-22 20:39 ` domob 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).