This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, libfortran] fix a**(-huge(i)-1)


Hello world,

this fixes PR 30981, where we used to hang at runtime
on 2.**(-huge(i)-1).  Regression-tested on i686-pc-linux-gnu.

OK for trunk and 4.2?

	Thomas

2007-03-01  Thomas Koenig  <Thomas.Koenig@online.de>

	PR libfortran/30981
	* m4/pow_m4: Use appropriate unsigned int type for u.
	* generated/pow_c10_i16.c: Regenerated.
	* generated/pow_c10_i4.c: Regenerated.
	* generated/pow_c10_i8.c: Regenerated.
	* generated/pow_c16_i16.c: Regenerated.
	* generated/pow_c16_i4.c: Regenerated.
	* generated/pow_c16_i8.c: Regenerated.
	* generated/pow_c4_i16.c: Regenerated.
	* generated/pow_c4_i4.c: Regenerated.
	* generated/pow_c4_i8.c: Regenerated.
	* generated/pow_c8_i16.c: Regenerated.
	* generated/pow_c8_i4.c: Regenerated.
	* generated/pow_c8_i8.c: Regenerated.
	* generated/pow_i16_i16.c: Regenerated.
	* generated/pow_i16_i4.c: Regenerated.
	* generated/pow_i16_i8.c: Regenerated.
	* generated/pow_i4_i16.c: Regenerated.
	* generated/pow_i4_i4.c: Regenerated.
	* generated/pow_i4_i8.c: Regenerated.
	* generated/pow_i8_i16.c: Regenerated.
	* generated/pow_i8_i4.c: Regenerated.
	* generated/pow_i8_i8.c: Regenerated.
	* generated/pow_r10_i16.c: Regenerated.
	* generated/pow_r10_i4.c: Regenerated.
	* generated/pow_r10_i8.c: Regenerated.
	* generated/pow_r16_i16.c: Regenerated.
	* generated/pow_r16_i4.c: Regenerated.
	* generated/pow_r16_i8.c: Regenerated.
	* generated/pow_r4_i16.c: Regenerated.
	* generated/pow_r4_i4.c: Regenerated.
	* generated/pow_r4_i8.c: Regenerated.
	* generated/pow_r8_i16.c: Regenerated.
	* generated/pow_r8_i4.c: Regenerated.
	* generated/pow_r8_i8.c: Regenerated.
Index: pow.m4
===================================================================
--- pow.m4	(revision 122410)
+++ pow.m4	(working copy)
@@ -46,7 +46,8 @@ rtype_name
 `pow_'rtype_code`_'atype_code (rtype_name a, atype_name b)
 {
   rtype_name pow, x;
-  atype_name n, u;
+  atype_name n;
+  `GFC_UINTEGER_'atype_kind` u;'
   
   n = b;
   x = a;
@@ -62,11 +63,14 @@ ifelse(rtype_letter,i,`dnl
 	    return (n & 1) ? -1 : 1;
 	  return (x == 0) ? 1 / x : 0;
 ',`
-	  n = -n;
+	  u = -n;
 	  x = pow / x;
 ')dnl
 	}
-      u = n;
+      else
+	{
+	   u = n;
+	}
       for (;;)
 	{
 	  if (u & 1)

Attachment: integer_exponentiation_1.f90
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]