public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65585] New: Implicit allocation of unallocated array with an implicit summation
@ 2015-03-26 16:26 dirteat at gmail dot com
2015-03-26 16:42 ` [Bug fortran/65585] " dominiq at lps dot ens.fr
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dirteat at gmail dot com @ 2015-03-26 16:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65585
Bug ID: 65585
Summary: Implicit allocation of unallocated array with an
implicit summation
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: dirteat at gmail dot com
Created attachment 35150
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35150&action=edit
10 lines code reproducing the bug
Hi there,
I did not find any bug report on this, but the small attached code compiled
with gcc-gfortran 4.9.2 implicitely allocate an non-allocated array; or
segfault, depending on how the implicit assignement is written.
Compiled with:
gfortran -c noalloc.f90; gfortran noalloc.o -o bug
With the assignemnt written as:
iamwild = iamfine
I get the following output:
Are you fine? 1.00000000 2.00000000 3.00000000 4.00000000
5.00000000 6.00000000 7.00000000 8.00000000
9.00000000 10.0000000
With the assignment written as:
iamwild(:) = iamfine(:)
I get the expected behavior:
./bug
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
#0 0x7F8CF04BA597
#1 0x7F8CF04BABAE
#2 0x7F8CEF9C66AF
#3 0x400BC3 in MAIN__ at noalloc.f90:?
Segmentation fault
PS: took me the day to understand why my code was not working with another
compiler... :-/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/65585] Implicit allocation of unallocated array with an implicit summation
2015-03-26 16:26 [Bug fortran/65585] New: Implicit allocation of unallocated array with an implicit summation dirteat at gmail dot com
@ 2015-03-26 16:42 ` dominiq at lps dot ens.fr
2015-03-26 16:59 ` dirteat at gmail dot com
2015-03-26 17:17 ` mikael at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-03-26 16:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65585
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
gfortran is behaving as expected: iamwild is allocated on assignment as stated
in the manual
-frealloc-lhs
An allocatable left-hand side of an intrinsic assignment is automatically
(re)allocated if it is either unallocated or has a different shape. The option
is enabled by default except when -std=f95 is given. See also -Wrealloc-lhs.
Note this apply to full arrays only, hence the segfault if you use iamwild(:)
and iamwild unallocated.
> PS: took me the day to understand why my code was not working with another
> compiler... :-/
If the "other compiler" is ifort, this behavior is not the default and has to
be set by some option.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/65585] Implicit allocation of unallocated array with an implicit summation
2015-03-26 16:26 [Bug fortran/65585] New: Implicit allocation of unallocated array with an implicit summation dirteat at gmail dot com
2015-03-26 16:42 ` [Bug fortran/65585] " dominiq at lps dot ens.fr
@ 2015-03-26 16:59 ` dirteat at gmail dot com
2015-03-26 17:17 ` mikael at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: dirteat at gmail dot com @ 2015-03-26 16:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65585
--- Comment #2 from EatDirt <dirteat at gmail dot com> ---
Sorry for the noise and thanks very much for the info.
I was completely unaware of the f2003 feature!
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/65585] Implicit allocation of unallocated array with an implicit summation
2015-03-26 16:26 [Bug fortran/65585] New: Implicit allocation of unallocated array with an implicit summation dirteat at gmail dot com
2015-03-26 16:42 ` [Bug fortran/65585] " dominiq at lps dot ens.fr
2015-03-26 16:59 ` dirteat at gmail dot com
@ 2015-03-26 17:17 ` mikael at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mikael at gcc dot gnu.org @ 2015-03-26 17:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65585
Mikael Morin <mikael at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikael at gcc dot gnu.org
--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> ---
The relevant section in the standard is:
7.2.1.3 Interpretation of intrinsic assignments
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-26 16:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 16:26 [Bug fortran/65585] New: Implicit allocation of unallocated array with an implicit summation dirteat at gmail dot com
2015-03-26 16:42 ` [Bug fortran/65585] " dominiq at lps dot ens.fr
2015-03-26 16:59 ` dirteat at gmail dot com
2015-03-26 17:17 ` mikael at gcc dot gnu.org
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).