[patch, fortran] power.f90 FAIL in testsuite
Scott Robert Ladd
coyote@coyotegulch.com
Mon Nov 1 20:22:00 GMT 2004
I'm looking for commentary on this proposed patch, which fixes the
incorrect calculation of integer powers when the base is 1. The patch
identifies power operations with an integer base of 1, and replace them
with a constant 1. The conversion takes place in eval_intrinsic().
Such a transform is logical, but I'm not certain I'm doing it in the
most appropriate place. I picked something small, so my glaring mistakes
could be easily identified... ;)
Then, of course, we get into the issue of whether or not other known
transforms should be applied, such as for real and complex types.
This patch also modifies the test suite slightly, by removing the
complex power tests from power.f90, and creating a new cpower.f90 test
that, at this time, fails, likely due to the complex-specific PR 17603.
The test suite is not very comprehensive, testing a few specific cases
but not general correctness. Combing integer, real, and complex tests
can cloud results. I'm willing to propose (as an example) test case
examples for ** operator tests, providing better coverage and granularity.
..Scott
2004-11-01 Scott Robert Ladd <scott.ladd@coyotegulch.com>
* gcc/fortran/arith.c (eval_intrinsic): Added transform from power
of integer 1 to a constant of 1
* gcc/testsuite/gfortran.fortran-torture/execute/power.f90:
Removed complex power tests to cpower.f90
* gcc/testsuite/gfortran.fortran-torture/execute/cpower.f90:
Complex power tests
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gfortran_1power.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20041101/e691ec7c/attachment.ksh>
More information about the Gcc-patches
mailing list