public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/37412]  New: No error on repeated declaration
@ 2008-09-07 20:52 jonasson at hi dot is
  2008-09-07 21:16 ` [Bug fortran/37412] " dominiq at lps dot ens dot fr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jonasson at hi dot is @ 2008-09-07 20:52 UTC (permalink / raw)
  To: gcc-bugs

The following program compiles OK with no message that st is being redefined.

function fun() result(st)
  character(2) st
  character(1) st
  st = '1'
end function fun


-- 
           Summary: No error on repeated declaration
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jonasson at hi dot is


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37412


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/37412] No error on repeated declaration
  2008-09-07 20:52 [Bug fortran/37412] New: No error on repeated declaration jonasson at hi dot is
@ 2008-09-07 21:16 ` dominiq at lps dot ens dot fr
  2008-09-07 21:37 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-09-07 21:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2008-09-07 21:15 -------
Confirmed with 4.2.3 and 4.3.2, with 4.4.0 (trunk) I get:

[ibook-dhum] f90/bug% gfc -Wall pr37412.f90
pr37412.f90:3.17:

  character(1) st
                1
Warning: Symbol 'st' at (1) already has basic type of CHARACTER

Now I am not sure which statement is the winner. Is this defined somewhere?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37412


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/37412] No error on repeated declaration
  2008-09-07 20:52 [Bug fortran/37412] New: No error on repeated declaration jonasson at hi dot is
  2008-09-07 21:16 ` [Bug fortran/37412] " dominiq at lps dot ens dot fr
@ 2008-09-07 21:37 ` burnus at gcc dot gnu dot org
  2008-09-07 22:07 ` dominiq at lps dot ens dot fr
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-09-07 21:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-09-07 21:35 -------
(In reply to comment #1)
> Warning: Symbol 'st' at (1) already has basic type of CHARACTER

I think one should print here an error as the LEN type parameter is different. 

The same issue exists for the KIND type parameter.

> Now I am not sure which statement is the winner. Is this defined somewhere?

I think it is a bug (cf. above) and thus not really defined. However, testing
with gfortran 4.3 implies that the latter definition wins.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |accepts-invalid
   Last reconfirmed|0000-00-00 00:00:00         |2008-09-07 21:35:53
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37412


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/37412] No error on repeated declaration
  2008-09-07 20:52 [Bug fortran/37412] New: No error on repeated declaration jonasson at hi dot is
  2008-09-07 21:16 ` [Bug fortran/37412] " dominiq at lps dot ens dot fr
  2008-09-07 21:37 ` burnus at gcc dot gnu dot org
@ 2008-09-07 22:07 ` dominiq at lps dot ens dot fr
  2008-09-08  6:37 ` domob at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-09-07 22:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dominiq at lps dot ens dot fr  2008-09-07 22:06 -------
With -std=f95 all the gfortran versions I have reject the code with:

[ibook-dhum] f90/bug% gfc -std=f95 pr37412.f90
pr37412.f90:3.17:

  character(1) st
                1
Error: Symbol 'st' at (1) already has basic type of CHARACTER

> I think one should print here an error as the LEN type parameter is different. 
>
> The same issue exists for the KIND type parameter.

I agree this would avoid to wonder which statement is taken into account.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37412


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/37412] No error on repeated declaration
  2008-09-07 20:52 [Bug fortran/37412] New: No error on repeated declaration jonasson at hi dot is
                   ` (2 preceding siblings ...)
  2008-09-07 22:07 ` dominiq at lps dot ens dot fr
@ 2008-09-08  6:37 ` domob at gcc dot gnu dot org
  2009-12-08 20:58 ` dfranke at gcc dot gnu dot org
  2009-12-08 21:01 ` dfranke at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: domob at gcc dot gnu dot org @ 2008-09-08  6:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from domob at gcc dot gnu dot org  2008-09-08 06:36 -------
IIRC, this behaviour is due to a patch I submitted some time ago.  Maybe I
could change this warning into an error even for non-standard conforming mode
in case the length or a kind parameter differs.  What do you think?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37412


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/37412] No error on repeated declaration
  2008-09-07 20:52 [Bug fortran/37412] New: No error on repeated declaration jonasson at hi dot is
                   ` (3 preceding siblings ...)
  2008-09-08  6:37 ` domob at gcc dot gnu dot org
@ 2009-12-08 20:58 ` dfranke at gcc dot gnu dot org
  2009-12-08 21:01 ` dfranke at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-08 20:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from dfranke at gcc dot gnu dot org  2009-12-08 20:58 -------
*** Bug 34527 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=37412


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug fortran/37412] No error on repeated declaration
  2008-09-07 20:52 [Bug fortran/37412] New: No error on repeated declaration jonasson at hi dot is
                   ` (4 preceding siblings ...)
  2009-12-08 20:58 ` dfranke at gcc dot gnu dot org
@ 2009-12-08 21:01 ` dfranke at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-08 21:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dfranke at gcc dot gnu dot org  2009-12-08 21:01 -------
(In reply to comment #4)
> Maybe I could change this warning into an error even for non-standard 
> conforming mode in case the length or a kind parameter differs.  What
> do you think?

I assume, this happened at some point. Current 4.5.0 20091208 gives:

$> gfortran-svn pr37412.f90
pr37412.f90:3.17:

  character(1) st
                 1
Error: Symbol 'st' at (1) already has basic type of CHARACTER

I believe this is correct. Closing.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37412


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-12-08 21:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-07 20:52 [Bug fortran/37412] New: No error on repeated declaration jonasson at hi dot is
2008-09-07 21:16 ` [Bug fortran/37412] " dominiq at lps dot ens dot fr
2008-09-07 21:37 ` burnus at gcc dot gnu dot org
2008-09-07 22:07 ` dominiq at lps dot ens dot fr
2008-09-08  6:37 ` domob at gcc dot gnu dot org
2009-12-08 20:58 ` dfranke at gcc dot gnu dot org
2009-12-08 21:01 ` dfranke 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).