]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/92629 (internal compiler error: in convert_mpz_to_unsigned...
authorHarald Anlauf <anlauf@gmx.de>
Fri, 29 Nov 2019 20:56:11 +0000 (20:56 +0000)
committerHarald Anlauf <anlauf@gcc.gnu.org>
Fri, 29 Nov 2019 20:56:11 +0000 (20:56 +0000)
2019-11-29  Harald Anlauf  <anlauf@gmx.de>

Backport from mainline
PR fortran/92629
* simplify.c (convert_mpz_to_unsigned): Skip assert for argument
range when -fno-range-check is specified.

PR fortran/92629
* gfortran.dg/pr92629.f90: New testcase.

From-SVN: r278862

gcc/fortran/ChangeLog
gcc/fortran/simplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr92629.f90 [new file with mode: 0644]

index 181a48c574e3e492aae4af200f58a5e5b153aa8d..d0d71467e7f8913ba07b7ecc55ca4525558760ad 100644 (file)
@@ -1,3 +1,10 @@
+2019-11-29  Harald Anlauf  <anlauf@gmx.de>
+
+       Backport from mainline
+       PR fortran/92629
+       * simplify.c (convert_mpz_to_unsigned): Skip assert for argument
+       range when -fno-range-check is specified.
+
 2019-11-25  Tobias Burnus  <tobias@codesourcery.com
 
        Backport from mainline
index 58b4652b01007020bb5e3504ff77b3827c991342..583a1c136e2b6267bb9f3b67ed3164fbdb73900a 100644 (file)
@@ -169,8 +169,10 @@ convert_mpz_to_unsigned (mpz_t x, int bitsize)
     }
   else
     {
-      /* Confirm that no bits above the signed range are set.  */
-      gcc_assert (mpz_scan1 (x, bitsize-1) == ULONG_MAX);
+      /* Confirm that no bits above the signed range are set if we
+        are doing range checking.  */
+      if (flag_range_check != 0)
+       gcc_assert (mpz_scan1 (x, bitsize-1) == ULONG_MAX);
     }
 }
 
index 66ead244df8fb46d05b20780d29def7a1294e2f1..671ff2887a30ccd98135a90f86d1685719a996f1 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-29  Harald Anlauf  <anlauf@gmx.de>
+
+       Backport from mainline
+       PR fortran/92629
+       * gfortran.dg/pr92629.f90: New testcase.
+
 2019-11-29 Tobias Burnus  <tobias@codesourcery.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/gfortran.dg/pr92629.f90 b/gcc/testsuite/gfortran.dg/pr92629.f90
new file mode 100644 (file)
index 0000000..5c2267c
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do run }
+! { dg-options "-fno-range-check" }
+!
+! Test the fix for PR92629.
+program bge_tests
+  if (bge (huge (1_1), 128_1)) stop 1
+  if (bge (    128_1 , 255_1)) stop 2
+  if (bge (huge (1_2), 32768_2)) stop 3
+  if (bge (huge (1_4), 2147483648_4)) stop 4
+  if (bge (huge (1_8), 9223372036854775808_8)) stop 5
+end program