From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28273 invoked by alias); 4 Apr 2008 15:45:41 -0000 Received: (qmail 28257 invoked by uid 22791); 4 Apr 2008 15:45:40 -0000 X-Spam-Status: No, hits=1.9 required=5.0 tests=AWL,BAYES_40,BOTNET,J_CHICKENPOX_41 X-Spam-Check-By: sourceware.org Received: from smtp.uniroma2.it (HELO smtp.uniroma2.it) (160.80.6.23) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 04 Apr 2008 15:45:20 +0000 Received: from smtpauth0.uniroma2.it (smtpauth1.uniroma2.it [160.80.1.177]) by smtp.uniroma2.it (8.13.6/8.13.6) with ESMTP id m34FT5HP005966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 4 Apr 2008 17:29:07 +0200 Received: from [192.168.1.42] (cerbero.mec.uniroma2.it [160.80.88.3]) (authenticated bits=0) by smtpauth0.uniroma2.it (8.13.8/8.13.8/Debian-3) with ESMTP id m34Fj6W3020018 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Fri, 4 Apr 2008 17:45:07 +0200 Subject: Re: Error message From: Salvatore Filippone Reply-To: salvatore.filippone@uniroma2.it To: Tobias Burnus Cc: Fortran@gcc.gnu.org In-Reply-To: <47F64B3C.2030704@net-b.de> References: <1207321671.3416.14.camel@localhost.localdomain> <47F64B3C.2030704@net-b.de> Content-Type: text/plain Date: Fri, 04 Apr 2008 15:45:00 -0000 Message-Id: <1207323746.3416.16.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-8.fc7) Content-Transfer-Encoding: 7bit X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Found to be clean X-MailScanner-From: salvatore.filippone@uniroma2.it Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org X-SW-Source: 2008-04/txt/msg00024.txt.bz2 I see, thanks Salvatore Il giorno ven, 04/04/2008 alle 17.37 +0200, Tobias Burnus ha scritto: > Salvatore Filippone wrote: > > Hi there, > > I am getting the following error message: > > > > Fortran runtime error: Incorrect extent in return value of PACK intrinsic; is 964, should be 7466 > > > > What is the compiler trying to tell me? > Example from the testsuite; compile with -fbounds-check: > > program main > integer :: a(2,2), b(5) > a = reshape((/ 1, -1, 1, -1 /), shape(a)) > b = pack(a, a /= 0) > end program main > ! { dg-output "Fortran runtime error: Incorrect extent in return value > of PACK intrinsic; is 4, should be 5" } > > The problem is that for "b =" an array with size 5 is needed while > "pack(a, a /= 0)" returns an array of size 4. > Solution: Use "b(1:4) =" or "b(2:5) =" or ... > > > If you have a Fortran 2003 compiler and b is allocatable, the assignment > "b = pack(a, a /= 0)" is actually valid as b will be reallocated to have > a size 4. Note, however, that gfortran does not support this yet. > > Tobias