OSDN Git Service

2008-09-06 Steven G. Kargl <kargls@comcast.net>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Sep 2008 15:27:50 +0000 (15:27 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 6 Sep 2008 15:27:50 +0000 (15:27 +0000)
       PR fortran/36153
       * fortran/resolve.c (resolve_function): Shortcircuit for SIZE and
       UBOUND if 2nd argument is KIND.

2008-09-06  Tobias Burnus  <burnus@net-b.de>

       PR fortran/36153
       * gfortran.dg/size_kind.f90: New test.

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

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

index e3f2dcd..0e64d91 100644 (file)
@@ -1,5 +1,11 @@
 2008-09-06  Steven G. Kargl  <kargls@comcast.net>
 
+       PR fortran/36153
+       * fortran/resolve.c (resolve_function): Shortcircuit for SIZE and
+       UBOUND if 2nd argument is KIND.
+
+2008-09-06  Steven G. Kargl  <kargls@comcast.net>
+
        PR fortran/33229
        * resolve.c (resolve_function): An intrinsic subroutine should not be
        called as a function.
index 485d331..05f2c14 100644 (file)
@@ -2336,17 +2336,18 @@ resolve_function (gfc_expr *expr)
         assumed size array argument.  UBOUND and SIZE have to be
         excluded from the check if the second argument is anything
         than a constant.  */
-      int inquiry;
-      inquiry = GENERIC_ID == GFC_ISYM_UBOUND
-                 || GENERIC_ID == GFC_ISYM_SIZE;
 
       for (arg = expr->value.function.actual; arg; arg = arg->next)
        {
-         if (inquiry && arg->next != NULL && arg->next->expr)
+         if ((GENERIC_ID == GFC_ISYM_UBOUND || GENERIC_ID == GFC_ISYM_SIZE)
+             && arg->next != NULL && arg->next->expr)
            {
              if (arg->next->expr->expr_type != EXPR_CONSTANT)
                break;
 
+             if (arg->next->name && strncmp(arg->next->name, "kind", 4) == 0)
+               break;
+
              if ((int)mpz_get_si (arg->next->expr->value.integer)
                        < arg->expr->rank)
                break;
index c094425..aaeb46c 100644 (file)
@@ -1,3 +1,8 @@
+2008-09-06  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/36153
+       * gfortran.dg/size_kind.f90: New test.
+
 2008-09-06  Steven G. Kargl  <kargls@comcast.net>
 
        PR fortran/33229
diff --git a/gcc/testsuite/gfortran.dg/size_kind.f90 b/gcc/testsuite/gfortran.dg/size_kind.f90
new file mode 100644 (file)
index 0000000..5ec6f7e
--- /dev/null
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! PR fortran/36153
+! Contributed by Jonathan Hogg
+! 
+program test_64
+   implicit none
+
+   integer, parameter :: long = selected_int_kind(18)
+   integer, parameter :: short = kind(0)
+
+   integer(long), parameter :: big_sz = huge(0_short)+1000_long
+   integer(long), parameter :: max_32 = huge(0_short)
+   integer, dimension(:), allocatable :: array
+
+   integer(long) :: i
+
+   print *, "2**31  = ", 2_long**31
+   print *, "max_32 = ", max_32
+   print *, "big_sz = ", big_sz
+
+   allocate(array(big_sz))
+   print *, "sz = ", size(array)
+   print *, "sz = ", size(array, kind=long)
+end program