public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/60144] Misleading error message when missing "then" after "if" and "else if"
       [not found] <bug-60144-4@http.gcc.gnu.org/bugzilla/>
@ 2014-02-11 14:35 ` kargl at gcc dot gnu.org
  2014-02-11 14:50 ` loximann at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: kargl at gcc dot gnu.org @ 2014-02-11 14:35 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug fortran/60144] Misleading error message when missing "then" after "if" and "else if"
       [not found] <bug-60144-4@http.gcc.gnu.org/bugzilla/>
  2014-02-11 14:35 ` [Bug fortran/60144] Misleading error message when missing "then" after "if" and "else if" kargl at gcc dot gnu.org
@ 2014-02-11 14:50 ` loximann at gmail dot com
  2014-02-11 18:31 ` dominiq at lps dot ens.fr
  2020-07-30 15:01 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 4+ messages in thread
From: loximann at gmail dot com @ 2014-02-11 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sergio Losilla <loximann at gmail dot com> ---
(In reply to kargl from comment #1)
> 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 far as I know, there are two possible statements starting with if:

if (<expr>) then
if (<expr>) <statement>

The compiler should recognize that *something* is missing, be it either a then
or a statement.

> As for the message that you think makes no sense, I suspect
> the parse has identified (.TRUE.) as a malformed expression.

Well, the message objectively makes no sense because there is no assignment
whatsoever. At the very least, the message is confusing.


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

* [Bug fortran/60144] Misleading error message when missing "then" after "if" and "else if"
       [not found] <bug-60144-4@http.gcc.gnu.org/bugzilla/>
  2014-02-11 14:35 ` [Bug fortran/60144] Misleading error message when missing "then" after "if" and "else if" kargl at gcc dot gnu.org
  2014-02-11 14:50 ` loximann at gmail dot com
@ 2014-02-11 18:31 ` dominiq at lps dot ens.fr
  2020-07-30 15:01 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-02-11 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-02-11
     Ever confirmed|0                           |1

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed on 4.7.4, 4.8.3, and trunk (4.9). Related to pr32151.


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

* [Bug fortran/60144] Misleading error message when missing "then" after "if" and "else if"
       [not found] <bug-60144-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-02-11 18:31 ` dominiq at lps dot ens.fr
@ 2020-07-30 15:01 ` dominiq at lps dot ens.fr
  3 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-30 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This is fixed since at least GCC7.

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

end of thread, other threads:[~2020-07-30 15:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-60144-4@http.gcc.gnu.org/bugzilla/>
2014-02-11 14:35 ` [Bug fortran/60144] Misleading error message when missing "then" after "if" and "else if" kargl at gcc dot gnu.org
2014-02-11 14:50 ` loximann at gmail dot com
2014-02-11 18:31 ` dominiq at lps dot ens.fr
2020-07-30 15:01 ` dominiq at lps dot ens.fr

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).