public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50541] New: gfortran should not accept a pointer as a generic-name (r178939)
@ 2011-09-27 14:28 zeccav at gmail dot com
2011-09-27 18:24 ` [Bug fortran/50541] " janus at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: zeccav at gmail dot com @ 2011-09-27 14:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50541
Bug #: 50541
Summary: gfortran should not accept a pointer as a generic-name
(r178939)
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: zeccav@gmail.com
! gfortran should not accept a pointer as a generic-name (r178939)
pointer s ! gfortran should complain here
interface s ! or here
function f()
! this is the right place to specify the pointer attribute
pointer f
end function
end interface
end
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50541] gfortran should not accept a pointer as a generic-name (r178939)
2011-09-27 14:28 [Bug fortran/50541] New: gfortran should not accept a pointer as a generic-name (r178939) zeccav at gmail dot com
@ 2011-09-27 18:24 ` janus at gcc dot gnu.org
2011-09-28 11:52 ` janus at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-09-27 18:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50541
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-09-27
CC| |janus at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #1 from janus at gcc dot gnu.org 2011-09-27 17:36:10 UTC ---
This one is trivial:
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (revision 179255)
+++ gcc/fortran/symbol.c (working copy)
@@ -504,6 +504,7 @@ check_conflict (symbol_attribute *attr, const char
conf (dummy, result);
conf (entry, result);
conf (generic, result);
+ conf (generic, pointer);
conf (function, subroutine);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50541] gfortran should not accept a pointer as a generic-name (r178939)
2011-09-27 14:28 [Bug fortran/50541] New: gfortran should not accept a pointer as a generic-name (r178939) zeccav at gmail dot com
2011-09-27 18:24 ` [Bug fortran/50541] " janus at gcc dot gnu.org
@ 2011-09-28 11:52 ` janus at gcc dot gnu.org
2011-09-28 15:17 ` burnus at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: janus at gcc dot gnu.org @ 2011-09-28 11:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50541
--- Comment #2 from janus at gcc dot gnu.org 2011-09-28 11:14:16 UTC ---
(In reply to comment #1)
> This one is trivial:
Unfortunately this causes one testsuite regression:
FAIL: gfortran.dg/func_derived_4.f90 -O0 (test for excess errors)
Reduced test case:
module class_field
implicit none
interface msh
module procedure msh
end interface
contains
function msh()
integer, pointer :: msh
end function
end module
What is special about this, is that the generic and the specific procedure
share the same name. I think the problem is that we only have one symbol for
both, which triggers the conflict.
Possible solutions:
* (quick'n'dirty) refine the check to only raise a conflict if there is no
specific procedure with the same name
* (cleaner but harder) introduce separate symbols for generics (in a separate
symtree), which might also solve our problems with 'constructors' (cf. PR
39427)
For specifics and generics with the same name, see also PR 42418.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50541] gfortran should not accept a pointer as a generic-name (r178939)
2011-09-27 14:28 [Bug fortran/50541] New: gfortran should not accept a pointer as a generic-name (r178939) zeccav at gmail dot com
2011-09-27 18:24 ` [Bug fortran/50541] " janus at gcc dot gnu.org
2011-09-28 11:52 ` janus at gcc dot gnu.org
@ 2011-09-28 15:17 ` burnus at gcc dot gnu.org
2013-04-16 8:53 ` zeccav at gmail dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-09-28 15:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50541
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-09-28 15:02:02 UTC ---
(In reply to comment #2)
> What is special about this, is that the generic and the specific procedure
> share the same name. I think the problem is that we only have one symbol for
> both, which triggers the conflict.
I think one could solve this at parse time. When parsing POINTER and
sym->attr.generic and gfc_ns_current->proc_name != sym, we set the attribute to
an interface block. Ditto when parsing "INTERFACE <generic_name>": If one has
already sym->attr.pointer, it is a bug. That should work without further
changes.
Regarding the constructor patch (PR 39427): At least with my current draft
patch does not use a different symbol.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50541] gfortran should not accept a pointer as a generic-name (r178939)
2011-09-27 14:28 [Bug fortran/50541] New: gfortran should not accept a pointer as a generic-name (r178939) zeccav at gmail dot com
` (2 preceding siblings ...)
2011-09-28 15:17 ` burnus at gcc dot gnu.org
@ 2013-04-16 8:53 ` zeccav at gmail dot com
2015-09-02 13:15 ` zeccav at gmail dot com
2021-02-27 9:56 ` zeccav at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: zeccav at gmail dot com @ 2013-04-16 8:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50541
Vittorio Zecca <zeccav at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|4.7.0 |4.8.0
--- Comment #4 from Vittorio Zecca <zeccav at gmail dot com> 2013-04-16 08:53:16 UTC ---
I still have the same bug on gfortran 4.8.0.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50541] gfortran should not accept a pointer as a generic-name (r178939)
2011-09-27 14:28 [Bug fortran/50541] New: gfortran should not accept a pointer as a generic-name (r178939) zeccav at gmail dot com
` (3 preceding siblings ...)
2013-04-16 8:53 ` zeccav at gmail dot com
@ 2015-09-02 13:15 ` zeccav at gmail dot com
2021-02-27 9:56 ` zeccav at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: zeccav at gmail dot com @ 2015-09-02 13:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50541
--- Comment #5 from Vittorio Zecca <zeccav at gmail dot com> ---
Bug still there in 5.2.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/50541] gfortran should not accept a pointer as a generic-name (r178939)
2011-09-27 14:28 [Bug fortran/50541] New: gfortran should not accept a pointer as a generic-name (r178939) zeccav at gmail dot com
` (4 preceding siblings ...)
2015-09-02 13:15 ` zeccav at gmail dot com
@ 2021-02-27 9:56 ` zeccav at gmail dot com
5 siblings, 0 replies; 7+ messages in thread
From: zeccav at gmail dot com @ 2021-02-27 9:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50541
--- Comment #7 from Vittorio Zecca <zeccav at gmail dot com> ---
The NAG nagfor and Intel ifort detect the issue.
gfortran -S gfbug81.f
[vitti f95]$nagfor -S gfbug81.f
NAG Fortran Compiler Release 7.0(Yurakucho) Build 7042
Error: gfbug81.f, line 4: Multiply defined symbol S
detected at INTERFACE@S
Warning: gfbug81.f, line 10: Unused local variable S
[NAG Fortran Compiler pass 1 error termination, 1 error, 1 warning]
[vitti f95]$ifort -S gfbug81.f
gfbug81.f(3): error #6449: This name has already been used as a generic
procedure name [S]
pointer s ! gfortran should complain here
--------------^
compilation aborted for gfbug81.f (code 1)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-02-27 9:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-27 14:28 [Bug fortran/50541] New: gfortran should not accept a pointer as a generic-name (r178939) zeccav at gmail dot com
2011-09-27 18:24 ` [Bug fortran/50541] " janus at gcc dot gnu.org
2011-09-28 11:52 ` janus at gcc dot gnu.org
2011-09-28 15:17 ` burnus at gcc dot gnu.org
2013-04-16 8:53 ` zeccav at gmail dot com
2015-09-02 13:15 ` zeccav at gmail dot com
2021-02-27 9:56 ` zeccav at gmail dot com
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).