[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
This commit is contained in:
Tobias Burnus 2008-09-06 17:27:50 +02:00
parent 2c68bc89b7
commit 7a687b2265
4 changed files with 41 additions and 4 deletions

View file

@ -1,3 +1,9 @@
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

View 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;

View 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

View file

@ -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