trans-expr.c (gfc_conv_cst_int_power): Compute x**(-n) by converting it to (1/x)...
authorToon Moene <toon@moene.indiv.nluug.nl>
Wed, 9 Jun 2004 19:57:24 +0000 (21:57 +0200)
committerToon Moene <toon@gcc.gnu.org>
Wed, 9 Jun 2004 19:57:24 +0000 (19:57 +0000)
2004-06-09  Toon Moene  <toon@moene.indiv.nluug.nl>

* trans-expr.c (gfc_conv_cst_int_power): Compute
x**(-n) by converting it to (1/x)**n instead of
1/x**n.

From-SVN: r82850

gcc/fortran/ChangeLog
gcc/fortran/trans-expr.c

index d8a6da4..a9f08c2 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-09  Toon Moene  <toon@moene.indiv.nluug.nl>
+
+       * trans-expr.c (gfc_conv_cst_int_power): Compute
+       x**(-n) by converting it to (1/x)**n instead of
+       1/x**n.
+
 2004-06-09  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
 
        PR fortran/13372
index dda08bb..2258ce6 100644 (file)
@@ -526,13 +526,14 @@ gfc_conv_cst_int_power (gfc_se * se, tree lhs, tree rhs)
 
   memset (vartmp, 0, sizeof (vartmp));
   vartmp[1] = lhs;
-
-  se->expr = gfc_conv_powi (se, n, vartmp);
   if (sgn == -1)
     {
       tmp = gfc_build_const (type, integer_one_node);
-      se->expr = build (RDIV_EXPR, type, tmp, se->expr);
+      vartmp[1] = build (RDIV_EXPR, type, tmp, vartmp[1]);
     }
+
+  se->expr = gfc_conv_powi (se, n, vartmp);
+
   return 1;
 }