From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F63F3858C41; Thu, 28 Dec 2023 17:46:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F63F3858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703785590; bh=qNFCiTB78pX54GmM8UXM0TaoyLMXP8EWZCfDlv9Sw2g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oVzgZ9/vI6F7Zcv5DnKjMw3lGEZFCcJFTDdhppR7RG0aI1agAxizKRc8Cmf89+Yr4 or4kgWQZQVrsva/WMq5qCN9xgU8otODBWszF3XKoJUewlG4HncbvPMB4Jxi2XxeNk0 HzEY5aGcigN42lTEfnBiTyta9yKCVM+pQ+QU5xjA= From: "kargl at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P5 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: priority cc bug_severity Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113165 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=3D1 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 =3D 65536.0d0 r =3D sqrt(d) print *,' r =3D ',r,' p =3D ',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=20 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=20 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.=