[Bug libfortran/52087] program does not follow logical rules

sgk at troutmask dot apl.washington.edu gcc-bugzilla@gcc.gnu.org
Thu Feb 2 02:10:00 GMT 2012


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

--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2012-02-02 02:10:04 UTC ---
On Thu, Feb 02, 2012 at 12:57:29AM +0000, ryan.maclellan at ua dot edu wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52087
> 
> --- Comment #2 from Ryan MacLellan <ryan.maclellan at ua dot edu> 2012-02-02 00:57:29 UTC ---
> I believe precedence is as follows:
> arithmetic expressions evaluated first
> followed by relational operators
> followed by logical operators
> 
> In this case I believe .eqv. are relational operators (equivalent to .eq.) and
> .or. is the logical operator.  So the .or. should be evaluated last but it
> doesn't seem to be.  If this is not the design precedence or .eqv. is not
> considered a relational operators then I may simply be in error.  Otherwise I
> think this is a bug.
> 

See Table 7.7 in the Fortran 2003 standard (Or your favorite
Fortran reference).

Table 7.7: Categories of operations and relative precedence
Category of operation              Operators              Precedence
     Extension                 defined-unary-op            Highest
      Numeric                          **                      .
      Numeric                        * or /                    .
      Numeric                    unary + or -                  .
      Numeric                   binary + or -                  .
     Character                         //                      .
     Relational       .EQ., .NE., .LT., .LE., .GT., .GE.,
                           ==, /=, <, <=, >, >=                .
      Logical                       .NOT.                      .
      Logical                       .AND.                      .
      Logical                        .OR.                      .
      Logical                 .EQV. or .NEQV.                  .
     Extension                defined-binary-op             Lowest



More information about the Gcc-bugs mailing list