Commit 7a687b22 by Tobias Burnus

[multiple changes]

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  Tobias Burnus  <burnus@net-b.de>

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

From-SVN: r140063
parent 2c68bc89
2008-09-06 Steven G. Kargl <kargls@comcast.net> 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 PR fortran/33229
* resolve.c (resolve_function): An intrinsic subroutine should not be * resolve.c (resolve_function): An intrinsic subroutine should not be
called as a function. called as a function.
......
...@@ -2336,17 +2336,18 @@ resolve_function (gfc_expr *expr) ...@@ -2336,17 +2336,18 @@ resolve_function (gfc_expr *expr)
assumed size array argument. UBOUND and SIZE have to be assumed size array argument. UBOUND and SIZE have to be
excluded from the check if the second argument is anything excluded from the check if the second argument is anything
than a constant. */ 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) 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) if (arg->next->expr->expr_type != EXPR_CONSTANT)
break; break;
if (arg->next->name && strncmp(arg->next->name, "kind", 4) == 0)
break;
if ((int)mpz_get_si (arg->next->expr->value.integer) if ((int)mpz_get_si (arg->next->expr->value.integer)
< arg->expr->rank) < arg->expr->rank)
break; break;
......
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> 2008-09-06 Steven G. Kargl <kargls@comcast.net>
PR fortran/33229 PR fortran/33229
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment