public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/113165] Code containing more than one type declaration for a variable results in confusing error messages from compiler
Date: Thu, 28 Dec 2023 17:46:29 +0000	[thread overview]
Message-ID: <bug-113165-4-L02rjlZipw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113165-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113165

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P5
                 CC|                            |kargl at gcc dot gnu.org
           Severity|normal                      |enhancement

--- Comment #1 from kargl at gcc dot gnu.org ---
You are hitting a run-on error caused by the first reported error.
If you are compiling old code or code you are currently writing or
code with a questionable pedigree, use the -fmax-errors=1 option.

For the record, your bug report is confusing ;-)
Because it includes error messages associated with your attached example:

      program multDecls
      double precision a,b,c,d,f,g
      integer i,j,k,l
      double precision d,q,r  ! 'd' was already declared as double prec.
      d = 65536.0d0
      r = sqrt(d)
      print *,' r = ',r,' p = ',p
      end program

but you refer to netlib code with a duplicate 't' declaration.

Due to the first error about 'd', the rest of the declaration is 
discarded.  The result is that 'q,r' have not been declared
and so have implicit types.  The option '-fimplicit-none' is telling
you about this problem.  Fix the first error and the run-on errors
go away.

Note, "Error: Symbol 'd' at (1) already has basic type of REAL" simply
means that 'd' has been typed as a REAL entity irrespective of the kind.
It does not mean that 'd' has been given a single precision type of 
REAL(4).  I suppose someone could change the error message to
a more generic "Error: Symbol 'd' at (1) has already been declared."
or some such wording.

  reply	other threads:[~2023-12-28 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-28 15:21 [Bug fortran/113165] New: " xecej4 at outlook dot com
2023-12-28 17:46 ` kargl at gcc dot gnu.org [this message]
2023-12-28 20:54 ` [Bug fortran/113165] " kargl at gcc dot gnu.org
2023-12-29 13:43 ` xecej4 at outlook dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-113165-4-L02rjlZipw@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).