From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32241 invoked by alias); 11 Feb 2014 14:35:10 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 32205 invoked by uid 48); 11 Feb 2014 14:35:07 -0000 From: "kargl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/60144] Misleading error message when missing "then" after "if" and "else if" Date: Tue, 11 Feb 2014 14:35:00 -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: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: kargl at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg01049.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60144 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #1 from kargl at gcc dot gnu.org --- (In reply to Sergio Losilla from comment #0) > Compiler version: > GNU Fortran (Ubuntu 20130917-1ubuntu1) 4.9.0 20130917 (experimental) [trunk > revision 202647] > > Test program: > -------------------- > program ifelif > if (.TRUE.) > else if (.FALSE.) > end if > end program > -------------------- > > Error messages: > ---------------------- > if.F90:2.15: > > if (.TRUE.) > 1 > Error: Cannot assign to a named constant at (1) > if.F90:3.11: > > else if (.FALSE.) > 1 > Error: Unexpected junk after ELSE statement at (1) > [...] > ---------------------- > > Both errors should read something like "Missing THEN after IF/ELSE IF". > > The first error message doesn't even make sense... How is the compiler suppose to know that the programmer may have meant program ifelif if (.TRUE.) i = 42 if (.FALSE.) then j = 42 end if end program As for the message that you think makes no sense, I suspect the parse has identified (.TRUE.) as a malformed expression.