[Bug fortran/42550] Unable to give initial value 2**0.5 to a real varable
------- Comment #2 from kargl at gcc dot gnu dot org 2009-12-30 00:55 -------
Code compiles fine on trunk, and a sensible error is emitted
when compiled with -std=f95.
troutmask:sgk[215] cat we.f90
PROGRAM myProg
REAL :: sqrt2 = 2**0.5
PRINT*, sqrt2
END PROGRAM myProg
troutmask:sgk[216] gfc4x -o z we.f90
troutmask:sgk[217] ./z
1.4142135
troutmask:sgk[218] gfc4x -o z -std=f95 we.f90
we.f90:2.24:
REAL :: sqrt2 = 2**0.5
1
Error: Fortran 2003: Noninteger exponent in an initialization expression at (1)
This was fixed by
2009-03-29 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/38823
* gfortran.h: Add ARITH_PROHIBIT to arith enum.
expr.c (gfc_match_init_expr): Add global variable init_flag to
flag matching an initialization expression.
(check_intrinsic_op): Move no longer reachable error message to ...
* arith.c (arith_power): ... here. Remove gfc_ prefix in
gfc_arith_power. Use init_flag. Allow constant folding of x**y
when y is REAL or COMPLEX.
(eval_intrinsic): Remove restriction that y in x**y must be INTEGER
for constant folding.
* gfc_power: Update gfc_arith_power to arith_power
If someone wants to backport the patch, you're welcomed to do so.
Please check that initializations aren't broke by your backport
(this is harder than one might think).
--
kargl at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|4.4.3 |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42550
------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
Reply to: