diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 903e9ab2505..6325c50a6e0 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2014-06-19 Francois-Xavier Coudert + + PR fortran/61454 + * expr.c (scalarize_intrinsic_call): Take care of optional + arguments. + 2014-06-19 Tobias Burnus * trans-intrinsic.c (conv_co_minmaxsum): Fix argument diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index f6772047e27..f0238c1b97e 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1955,7 +1955,7 @@ scalarize_intrinsic_call (gfc_expr *e) for (; a; a = a->next) { n++; - if (a->expr->expr_type != EXPR_ARRAY) + if (!a->expr || a->expr->expr_type != EXPR_ARRAY) continue; array_arg = n; expr = gfc_copy_expr (a->expr); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5138e5a9641..5d58712f7e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Francois-Xavier Coudert + + PR fortran/61454 + * gfortran.dg/pr61454.f90: New file. + 2014-06-19 Terry Guo * gcc.target/arm/thumb1-load-64bit-constant-1.c: New test. diff --git a/gcc/testsuite/gfortran.dg/pr61454.f90 b/gcc/testsuite/gfortran.dg/pr61454.f90 new file mode 100644 index 00000000000..75e457267ba --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr61454.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } + + implicit none + integer, parameter :: arr(2) = [ 1, 3 ] + real, parameter :: arr2(2) = [ 1.5, 2.1 ] + integer, parameter :: j = int(sum(arr)) + integer, parameter :: k = ceiling(sum(arr2)) + real(kind=j) :: x1 + real(kind=k) :: x2 + + print *, j, k + print *, x1, x2 + + end