[Bug fortran/49659] If-and-condition not obeyed using the g77-compiler (Windows 7, 64-bit).

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Wed Jul 6 12:02:00 GMT 2011


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

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-07-06 12:01:59 UTC ---
> Strangely ifort outputs the same result, so it must be correct ...

Indeed! The standard says

7.1.3 Precedence of operators

1 There is a precedence among the intrinsic and extension operations
corresponding to the form of expressions speci ed in 7.1.2, which
determines the order in which the operands are combined unless the order is
changed by the use of parentheses.  This precedence order is summarized in
Table 7.2.  

Table 7.2:

Categories of operations and relative precedence

Category of operation   Operators           Precedence

Extension               defined-unary-op    Highest
Numeric                 **                  .
Numeric                 *, /                .
Numeric                 unary +, -          .
Numeric                 binary +, -         .
Character               //                  .
Relational              .EQ., .NE., .LT., 
                        .LE., .GT., .GE.,
                        ==, /=, <, <=, >, 
                        >=  .
Logical                 .NOT.               .
Logical                 .AND.               .
Logical                 .OR.                .
Logical                 .EQV., .NEQV.       .
Extension               defined-binary-op   Lowest

>From this table 'C.eq.4.and.M.eqv..FALSE.' is computed as
'((C.eq.4).and.M).eqv..FALSE)' which is .TRUE..

> (thus, your program is invalid).

The program is not invalid, but the reporter expectation is.



More information about the Gcc-bugs mailing list