public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31465]  New: spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type
@ 2007-04-03 17:21 michael dot a dot richmond at nasa dot gov
  2007-04-04  8:44 ` [Bug fortran/31465] " pault at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: michael dot a dot richmond at nasa dot gov @ 2007-04-03 17:21 UTC (permalink / raw)
  To: gcc-bugs

The program listed below produces a spurious error message:

test.f90:2.11:

PARAMETER(C = 0.0D0)
          1
Error: Implicitly typed PARAMETER 'c' at (1) doesn't match a later IMPLICIT
type

The message will disappear if I put the IMPLICIT declaration before the
PARAMETER declaration.

PROGRAM test
PARAMETER(C = 0.0D0)
IMPLICIT REAL*8 (C)
END


-- 
           Summary: spurious error: Implicitly typed PARAMETER doesn't match
                    a later IMPLICIT type
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot a dot richmond at nasa dot gov


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


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

* [Bug fortran/31465] spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type
  2007-04-03 17:21 [Bug fortran/31465] New: spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type michael dot a dot richmond at nasa dot gov
@ 2007-04-04  8:44 ` pault at gcc dot gnu dot org
  2007-04-04 14:47 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-04-04  8:44 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1340 bytes --]



------- Comment #1 from pault at gcc dot gnu dot org  2007-04-04 09:44 -------
This fixes the immediate problem.  I have to check with the standard if the
parameter is meant to take all of its characteristics from the value or if it
is just KIND.

Index: gcc/fortran/decl.c
===================================================================
*** gcc/fortran/decl.c  (révision 123426)
--- gcc/fortran/decl.c  (copie de travail)
*************** do_parm (void)
*** 3992,3997 ****
--- 3992,4000 ----
        goto cleanup;
      }

+   if (sym->attr.implicit_type)
+     sym->ts.kind = init->ts.kind;
+
    if (gfc_check_assign_symbol (sym, init) == FAILURE
        || gfc_add_flavor (&sym->attr, FL_PARAMETER, sym->name, NULL) ==
FAILURE
)
      {

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-04-04 09:44:00
               date|                            |


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


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

* [Bug fortran/31465] spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type
  2007-04-03 17:21 [Bug fortran/31465] New: spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type michael dot a dot richmond at nasa dot gov
  2007-04-04  8:44 ` [Bug fortran/31465] " pault at gcc dot gnu dot org
@ 2007-04-04 14:47 ` burnus at gcc dot gnu dot org
  2007-04-04 16:48 ` burnus at gcc dot gnu dot org
  2007-04-05  8:51 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-04 14:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-04-04 15:47 -------
Note: NAG f95 has the error:
 Error: foo.f90, line 7: IMPLICIT setting for letter C changed after use in
TEST
 Errors in declarations, no further processing for TEST

I think strictly speaking, NAG f95 is right.

With g95, ifort and sunf95, C is REAL(4).

Thus they ignore the implicit Real*8 (C) for the parameter "C".

(Of cause, if one places the implicit before the parameter statment, all
compiler do the same: C is a Real*8)

I would argue that an error message make sense. While the error message in NAG
f95 is clearer, the one of gfortran is already pretty good.

What does the original reporter expected -- C being REAL(4) or REAL(8)? I think
most source code readers expect the latter while the three compilers which
accept it have all REAL(4).

If you decide to allow this, please add a default warning about chaning the
implicit type.


-- 


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


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

* [Bug fortran/31465] spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type
  2007-04-03 17:21 [Bug fortran/31465] New: spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type michael dot a dot richmond at nasa dot gov
  2007-04-04  8:44 ` [Bug fortran/31465] " pault at gcc dot gnu dot org
  2007-04-04 14:47 ` burnus at gcc dot gnu dot org
@ 2007-04-04 16:48 ` burnus at gcc dot gnu dot org
  2007-04-05  8:51 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-04-04 16:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2007-04-04 17:48 -------
>From the standard:
"5.2.9 PARAMETER statement
[...]
The named constant shall have its type, type parameters, and shape specified in
a prior specification of the specification-part or declared implicitly (5.3).
If the named constant is typed by the implicit typing rules, its appearance in
any subsequent specification of the specification-part shall confirm this
implied
type and the values of any implied type parameters."

Thus implies gfortran does the right thing - at least for -std=f95/f2003.


-- 


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


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

* [Bug fortran/31465] spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type
  2007-04-03 17:21 [Bug fortran/31465] New: spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type michael dot a dot richmond at nasa dot gov
                   ` (2 preceding siblings ...)
  2007-04-04 16:48 ` burnus at gcc dot gnu dot org
@ 2007-04-05  8:51 ` pault at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-04-05  8:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2007-04-05 09:51 -------
(In reply to comment #3)
> From the standard:
> "5.2.9 PARAMETER statement
> [...]
> The named constant shall have its type, type parameters, and shape specified in
> a prior specification of the specification-part or declared implicitly (5.3).
> If the named constant is typed by the implicit typing rules, its appearance in
> any subsequent specification of the specification-part shall confirm this
> implied
> type and the values of any implied type parameters."
> Thus implies gfortran does the right thing - at least for -std=f95/f2003.

You are right - I will close it as invalid.

Sorry, Michael, but it appears that your code is standard defying.  If you
disagree, please come back to us.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2007-04-05  8:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-03 17:21 [Bug fortran/31465] New: spurious error: Implicitly typed PARAMETER doesn't match a later IMPLICIT type michael dot a dot richmond at nasa dot gov
2007-04-04  8:44 ` [Bug fortran/31465] " pault at gcc dot gnu dot org
2007-04-04 14:47 ` burnus at gcc dot gnu dot org
2007-04-04 16:48 ` burnus at gcc dot gnu dot org
2007-04-05  8:51 ` pault 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).