PR fortran/61454
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Jun 2014 11:58:55 +0000 (11:58 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Jun 2014 11:58:55 +0000 (11:58 +0000)
* expr.c (scalarize_intrinsic_call): Take care of optional
arguments.
* gfortran.dg/pr61454.f90: New file.

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

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

index 903e9ab..6325c50 100644 (file)
@@ -1,3 +1,9 @@
+2014-06-19  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/61454
+       * expr.c (scalarize_intrinsic_call): Take care of optional
+       arguments.
+
 2014-06-19  Tobias Burnus  <burnus@net-b.de>
 
        * trans-intrinsic.c (conv_co_minmaxsum): Fix argument
index f677204..f0238c1 100644 (file)
@@ -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);
index 5138e5a..5d58712 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-19  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR fortran/61454
+       * gfortran.dg/pr61454.f90: New file.
+
 2014-06-19  Terry Guo  <terry.guo@arm.com>
 
        * 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 (file)
index 0000000..75e4572
--- /dev/null
@@ -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