[Bug fortran/34536] Make support of 2.0**-3*5 tighter: Print warning by default

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Dec 20 14:05:00 GMT 2007



------- Comment #3 from burnus at gcc dot gnu dot org  2007-12-20 14:04 -------
> Exponentation has a higher precedence than multiplication, so
>     2.0**-3*5 <=> (2.0**(-3)) * 5

You forgot about the minus sign. You have:
  [constant][exponent][minus][constant][times][constant]
and not
  [constant][exponent][level-1 expr][times][constant]
(with level-1 expr = "([unary minus][constant])"

Thus one can say: [times] comes before [minus] and thus:
  [2.0][exponent]([minus]([3][times][5])
but one can also claim that the exponent comes first and the user probably
meant an unary [minus]:
  ([2.0][exponent]([minus][3]))[times][5]

a) is what intel does (without -stand f03)
b) is what gfortran does (without -std=f2003)

I cannot find exactly where it is forbidden, but it boils down that
   expression operator expression
is allowed and
   expression operator operator expression
is not. Also all compilers agree that it is non-standard Fortran.


-- 


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



More information about the Gcc-bugs mailing list