From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15812 invoked by alias); 12 Jan 2006 00:11:40 -0000 Received: (qmail 22215 invoked by alias); 11 Jan 2006 22:02:22 -0000 Date: Thu, 12 Jan 2006 00:11:00 -0000 Message-ID: <20060111220222.22198.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/24886] another runtime error goes undetected In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "uttamp at us dot ibm dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-01/txt/msg01121.txt.bz2 List-Id: ------- Comment #6 from uttamp at us dot ibm dot com 2006-01-11 22:02 ------- Subject: Re: another runtime error goes undetected On Wed, 2006-01-11 at 09:07 +0000, pault at gcc dot gnu dot org wrote: > > ------- Comment #5 from pault at gcc dot gnu dot org 2006-01-11 09:07 ------- > (In reply to comment #4) > > This is not a bug. gfortran behavior is identical to ifort. > > > Actually, it is quite specifically NOT permitted by the standard. To quote > 12.4.1.1: > > "If a scalar dummy argument is of type default character, the length len of the > dummy argument shall be less than or equal to the length of the actual > argument. The dummy argument becomes associated with the leftmost len > characters of the actual argument. If an array dummy argument is of type > default character, the restriction on the length is for the entire array and > not for each array element." > > The reason for this is obvious enough; try writing beyond len and you will > eventually get a seg fault. > > Uttam is quite correct to pick this out as a bug, although I am not sure that > we want a runtime error, except when -fbounds-check is active. This could be > implemented, with advantage in trans-expr(gfc_conv_function_call) by copying > over some of the code from trans-array.c. Compile time check will be much better fix than the runtime. > > As it happens, in building a fix for PRs 20881, 23308 & 25710, I am about to > add "same file" argument checking, which is why I encountered this PR. It will > fix Uttam's testcase but not the case where subroutine foo is truly external. > - Uttam -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24886