From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18483 invoked by alias); 4 Nov 2010 14:40:00 -0000 Received: (qmail 18466 invoked by uid 22791); 4 Nov 2010 14:39:59 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Nov 2010 14:39:55 +0000 Received: from [192.168.178.22] (port-92-204-92-55.dynamic.qsc.de [92.204.92.55]) by mx01.qsc.de (Postfix) with ESMTP id 7CA9E3CCB2; Thu, 4 Nov 2010 15:39:52 +0100 (CET) Message-ID: <4CD2C5B6.5060507@net-b.de> Date: Thu, 04 Nov 2010 14:45:00 -0000 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101026 SUSE/3.1.6 Thunderbird/3.1.6 MIME-Version: 1.0 Newsgroups: gmane.comp.gcc.patches,gmane.comp.gcc.fortran To: Dominique Dhumieres CC: paul.richard.thomas@gmail.com, gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org Subject: Re: (Re)allocation of allocatable arrays on assignment - F2003 References: <20101009134002.157E83BE0F@mailhost.lps.ens.fr> <20101023202653.2DF9D3BE18@mailhost.lps.ens.fr> <4CC47A12.7050504@net-b.de> <20101031215043.8B69A3BE18@mailhost.lps.ens.fr> <20101101101824.F0F663BE18@mailhost.lps.ens.fr> <20101102222221.CB2BB3BE18@mailhost.lps.ens.fr> <4CD273ED.7040903@net-b.de> <4CD27535.5020509@net-b.de> <4CD27860.50709@net-b.d e> <20101104141952.599F53BE18@mailhost.lps.ens.fr> In-Reply-To: <20101104141952.599F53BE18@mailhost.lps.ens.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-11/txt/msg00418.txt.bz2 On 11/04/2010 03:19 PM, Dominique Dhumieres wrote: > First the good news: > (1) the last patch woke up one bug of my collection (pr28849) > with another bound problem: > > [macbook] f90/bug% cat pr28849_db.f90 [...] > print *, "...and with wrong shape (should fail with bounds checking on)" > a(:,:) = reshape (v(:), (/ 2, 1 /) ) > b(:,:) = reshape (v(:), (/ 1, 2 /) ) Without bound checks (and realloc-lhs) I get the same result as with ifort and crayftn. However, for the last line shown above (line 20) I get with gfortran a segfault which valgrind diagnoses as: ==25067== Invalid write of size 4 ==25067== at 0x40188D: MAIN__ (pr28849_db.f90:20) > So either a is relocated as a(2,1) (b as b(1,2)) and the bounds > are inconsistent, or it is not and there should be a run time > error as when compiled with -std=f95. I think the program is valid Fortran 2003 and thus no bound check error should be printed. Despite ifort and crayftn showing the same bounds, I think you are right that the bounds are wrong. Some other results: a) I immediately get a segfault if I comments out the allocate statement. b) If I comment out the first part of the example ("correct bounds", i.e. not reallocation), I get the result: ...and with wrong shape (should fail with bounds checking on) a(:,1) = 1.0000000 1 1 1 2 b(:,1) = 1.0000000 -1.33410292E-32 1 1 2 1 Note the uninitialized value for b(2,1). Tobias