This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32669] New: "Actual argument contains too few elements for dummy argument" is triggered for valid code
- From: "jaydub66 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Jul 2007 23:17:42 -0000
- Subject: [Bug fortran/32669] New: "Actual argument contains too few elements for dummy argument" is triggered for valid code
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following piece of code is rejected:
program tfe
implicit none
real ,dimension(1:4) :: x
real ,dimension(0:3) :: y
real ,dimension(-1:2) :: z
call sub(x(:))
call sub(y(:))
call sub(z(:))
contains
subroutine sub(a)
implicit none
real,dimension(1:4) :: a
end subroutine sub
end program tfe
with these error messages:
too_few_elements.f90:10.9:
call sub(y(:))
1
Warning: Actual argument contains too few elements for dummy argument 'a' (3/4)
at (1)
too_few_elements.f90:11.9:
call sub(z(:))
1
Warning: Actual argument contains too few elements for dummy argument 'a' (2/4)
at (1)
Seems like for arrays with the notation x(:) the actual size is miscomputed if
they appear as an argument to a subroutine.
Apparently this just happens for arrays whose lower bound is zero or less
(y,z), while for positive lower bound everything is fine (x).
Also there is no problem if the array is given in the form "y(0:3)" or just
"y".
The code above is accepted by gcc 4.1 and 4.2, but rejected by recent 4.3 trunk
builds. So it seems to be a regression introduced in 4.3.
The error messages come from interface.c(compare_actual_formal), line 1608. The
size of the actual argument is computed by
actual_size = get_expr_storage_size(a->expr);
Maybe there is a problem in this routine?
--
Summary: "Actual argument contains too few elements for dummy
argument" is triggered for valid code
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jaydub66 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32669