]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2008-10-12 Steven G. Kargl <kargls@comcast.net>
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 12 Oct 2008 09:38:18 +0000 (09:38 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 12 Oct 2008 09:38:18 +0000 (09:38 +0000)
PR fortran/37792
* fortran/resolve.c (resolve_fl_variable): Simplify the
initializer if there is one.

2008-10-12  Steven G. Kargl  <kargls@comcast.net>

PR fortran/37792
* gfortran.dg/arithmetic_overflow_1.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141072 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 9393dae8a26d9512ff6ca717182132c86d3bc565..3d8b8265ea40f4e23f85850168f45b69624c7a83 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-12  Steven G. Kargl  <kargls@comcast.net>
+
+       PR fortran/37792
+       * fortran/resolve.c (resolve_fl_variable): Simplify the
+       initializer if there is one.
+
 2008-10-11  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/37794
index 6976e64e0c85f82e3e3d322238fa65a31cce85e3..70d3ad5df99862e625a88fdebf636ffe47a53428 100644 (file)
@@ -7525,6 +7525,10 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag)
        }
     }
 
+  /* Ensure that any initializer is simplified.  */
+  if (sym->value)
+    gfc_simplify_expr (sym->value, 1);
+
   /* Reject illegal initializers.  */
   if (!sym->mark && sym->value)
     {
index 33940f7fe0db327501f01f8adaeb4316d09c3698..92b1f53b6fcef5e92c29a59da7b914b83c9bcad0 100644 (file)
@@ -1,3 +1,8 @@
+2008-10-12  Steven G. Kargl  <kargls@comcast.net>
+
+       PR fortran/37792
+       * gfortran.dg/arithmetic_overflow_1.f90: New test.
+
 2008-10-11  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/loop_optimization5.adb: New test.
diff --git a/gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90 b/gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90
new file mode 100644 (file)
index 0000000..b19844f
--- /dev/null
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! Fixes PR37787 where the arithmetic overflow was not detected and an ICE ensued.
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+!
+program bug
+  implicit none
+   integer(1) :: a(2) = (/ Z'FF', Z'FF' /) ! { dg-error "Arithmetic overflow" }
+   print*, a
+end program bug