From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7722 invoked by alias); 11 Apr 2007 19:26:24 -0000 Received: (qmail 6532 invoked by uid 48); 11 Apr 2007 19:26:11 -0000 Date: Wed, 11 Apr 2007 19:26:00 -0000 Message-ID: <20070411192611.6531.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/31538] result_in_spec_1.f90: Invalid write In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-04/txt/msg00773.txt.bz2 ------- Comment #1 from burnus at gcc dot gnu dot org 2007-04-11 20:26 ------- Actually, it turned out that this is an out-of-bounds problem: character(len(ch)) :: chr(2) chr = test2 (1) however, test(1) returns an array of the size (2*1+1)+1 = 4. gfortran's -fbounds-check message is a bit misleading, though: Fortran runtime error: Array bound mismatch for dimension 1 of array 'r' (in file '/home/tob/projects/gcc/gcc/testsuite/gfortran.dg/result_in_spec_1.f90', at line 22) I think NAG f95's is better: Rank 1 of array operand has extent 4 instead of 2 In MYFUNC, line 42 of result_in_spec_1.f90 Line 22 is: do i = 1, len(r) where "r" is function result character(len=3),dimension(4). And line 42 is: chr = test2 (1) The test case needs to be fixed, the question is whether the bounding error should be improved too? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31538