From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24154 invoked by alias); 4 Apr 2008 15:37:59 -0000 Received: (qmail 24146 invoked by uid 22791); 4 Apr 2008 15:37:59 -0000 X-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_41 X-Spam-Check-By: sourceware.org Received: from mail1.physik.fu-berlin.de (HELO mail1.physik.fu-berlin.de) (160.45.35.12) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 04 Apr 2008 15:37:39 +0000 Received: from ith.physik.fu-berlin.de ([160.45.32.115] helo=[127.0.0.1]) by mail1.physik.fu-berlin.de with esmtp (Exim 4.63) (envelope-from ) id 1Jhnyv-0001if-Fp; Fri, 04 Apr 2008 17:37:36 +0200 Message-ID: <47F64B3C.2030704@net-b.de> Date: Fri, 04 Apr 2008 15:37:00 -0000 From: Tobias Burnus User-Agent: Thunderbird 2.0.0.12 (X11/20071114) MIME-Version: 1.0 To: salvatore.filippone@uniroma2.it CC: Fortran@gcc.gnu.org Subject: Re: Error message References: <1207321671.3416.14.camel@localhost.localdomain> In-Reply-To: <1207321671.3416.14.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-ZEDV-Virus-Scanned: No viruses found. [ClamAV 0.92/6586/Fri Apr 4 16:26:59 2008] X-ZEDV-Spam-Level: -- X-ZEDV-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on zs01.physik.fu-berlin.de X-ZEDV-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.3 X-ZEDV-Spam-Report: * -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] X-Scan-Signature: 86802e08418221ed23bb6b0842cad562 X-IsSubscribed: yes 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/msg00023.txt.bz2 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