From: Tobias Burnus <burnus@net-b.de>
To: salvatore.filippone@uniroma2.it
Cc: Fortran@gcc.gnu.org
Subject: Re: Error message
Date: Fri, 04 Apr 2008 15:37:00 -0000 [thread overview]
Message-ID: <47F64B3C.2030704@net-b.de> (raw)
In-Reply-To: <1207321671.3416.14.camel@localhost.localdomain>
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
next prev parent reply other threads:[~2008-04-04 15:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-04 15:11 Salvatore Filippone
2008-04-04 15:37 ` Tobias Burnus [this message]
2008-04-04 15:45 ` Salvatore Filippone
2018-02-05 17:16 error message paul starr
2022-10-17 9:28 Error message Salvatore Filippone
2022-10-17 14:42 ` Andrew Benson
2022-10-17 16:05 ` Salvatore Filippone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47F64B3C.2030704@net-b.de \
--to=burnus@net-b.de \
--cc=Fortran@gcc.gnu.org \
--cc=salvatore.filippone@uniroma2.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).