From 7a99defe0dbef55bcbcf2df076a896cc0e7e6658 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Sun, 12 Oct 2008 09:38:18 +0000 Subject: re PR fortran/37792 (ICE in gfc_conv_array_initializer; works with -fno-range-check) 2008-10-12 Steven G. Kargl PR fortran/37792 * fortran/resolve.c (resolve_fl_variable): Simplify the initializer if there is one. 2008-10-12 Steven G. Kargl PR fortran/37792 * gfortran.dg/arithmetic_overflow_1.f90: New test. From-SVN: r141072 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/resolve.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90 | 10 ++++++++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9393dae..3d8b826 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-10-12 Steven G. Kargl + + PR fortran/37792 + * fortran/resolve.c (resolve_fl_variable): Simplify the + initializer if there is one. + 2008-10-11 Paul Thomas PR fortran/37794 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 6976e64..70d3ad5 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 33940f7..92b1f53 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-10-12 Steven G. Kargl + + PR fortran/37792 + * gfortran.dg/arithmetic_overflow_1.f90: New test. + 2008-10-11 Eric Botcazou * 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 index 0000000..b19844f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/arithmetic_overflow_1.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! Fixes PR37787 where the arithmetic overflow was not detected and an ICE ensued. +! +! Contributed by Tobias Burnus +! +program bug + implicit none + integer(1) :: a(2) = (/ Z'FF', Z'FF' /) ! { dg-error "Arithmetic overflow" } + print*, a +end program bug -- cgit v1.1