re PR fortran/32669 ("Actual argument contains too few elements for dummy argument" is triggered for valid code)

2007-07-08  Tobias Burnus  <burnus@net-b.de>

	PR fortran/32669
	* interface.c (get_expr_storage_size): Properly obtain lower bound.
	(compare_actual_formal): Add space before parenthesis.

2007-07-08  Tobias Burnus  <burnus@net-b.de>

	PR fortran/32669
	* gfortran.dg/argument_checking_6.f90: New.

From-SVN: r126467
This commit is contained in:
Tobias Burnus 2007-07-08 22:57:07 +02:00 committed by Tobias Burnus
parent 83b2e4e821
commit 376397285d
4 changed files with 43 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2007-07-08 Tobias Burnus <burnus@net-b.de>
PR fortran/32669
* interface.c (get_expr_storage_size): Properly obtain lower bound.
(compare_actual_formal): Add space before parenthesis.
2007-07-08 Daniel Franke <franke.daniel@gmail.com>
PR fortran/25094

View File

@ -1374,7 +1374,7 @@ get_expr_storage_size (gfc_expr *e)
{
long int start, end, stride;
stride = 1;
start = 1;
if (ref->u.ar.stride[i])
{
if (ref->u.ar.stride[i]->expr_type == EXPR_CONSTANT)
@ -1390,6 +1390,11 @@ get_expr_storage_size (gfc_expr *e)
else
return 0;
}
else if (ref->u.ar.as->lower[i]
&& ref->u.ar.as->lower[i]->expr_type == EXPR_CONSTANT)
start = mpz_get_si (ref->u.ar.as->lower[i]->value.integer);
else
return 0;
if (ref->u.ar.end[i])
{
@ -1595,8 +1600,8 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
}
}
actual_size = get_expr_storage_size(a->expr);
formal_size = get_sym_storage_size(f->sym);
actual_size = get_expr_storage_size (a->expr);
formal_size = get_sym_storage_size (f->sym);
if (actual_size != 0 && actual_size < formal_size)
{
if (a->expr->ts.type == BT_CHARACTER && !f->sym->as && where)

View File

@ -1,3 +1,8 @@
2007-07-08 Tobias Burnus <burnus@net-b.de>
PR fortran/32669
* gfortran.dg/argument_checking_6.f90: New.
2007-07-08 Daniel Franke <franke.daniel@gmail.com>
PR fortran/25094

View File

@ -0,0 +1,24 @@
! { dg-do compile }
! PR fortran/32669
!
! Contributed by Janus Weil <jaydub66@gmail.com>
!
program tfe
implicit none
real,dimension(-1:1) :: w
real,dimension(1:4) :: x
real,dimension(0:3) :: y
real,dimension(-1:2) :: z
call sub(x(:))
call sub(y(:))
call sub(z(:))
call sub(w(:)) ! { dg-error "too few elements" }
contains
subroutine sub(a)
implicit none
real,dimension(1:4) :: a
end subroutine sub
end program tfe