public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/55134] New: associate construct and assumed size array
@ 2012-10-30 9:48 valeryweber at hotmail dot com
2012-10-30 11:34 ` [Bug fortran/55134] " burnus at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: valeryweber at hotmail dot com @ 2012-10-30 9:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55134
Bug #: 55134
Summary: associate construct and assumed size array
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: valeryweber@hotmail.com
Dear All
I get a wrong result when associating an array via an associate construct and
passing it as assumed size array to a routine.
gcc version 4.8.0 20121018 (experimental) (GCC)
>>>>>>
program bug
implicit none
integer,dimension(1)::i
i(:)=1
associate(a =>i)
call foo(a)
end associate
write(*,*) i
contains
subroutine foo(v)
integer, dimension(*) :: v
v(1)=2
end subroutine foo
end program bug
<<<<<<
this gives me
./a.out
1
while I would expect 2
Valery
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/55134] associate construct and assumed size array
2012-10-30 9:48 [Bug fortran/55134] New: associate construct and assumed size array valeryweber at hotmail dot com
@ 2012-10-30 11:34 ` burnus at gcc dot gnu.org
2012-10-31 17:23 ` burnus at gcc dot gnu.org
2012-10-31 17:24 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-10-30 11:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55134
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-10-30
CC| |burnus at gcc dot gnu.org,
| |janus at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-10-30 11:34:37 UTC ---
>From the dump. gfortran first generates a deferred-shape array:
a.data = (void * restrict) &i[0];
That's fine. But instead of passing
foo (&a);
it should pass
foo (a.data);
In resolve.c's resolve_assoc_var, one properly sets sym->as->type =
AS_DEFERRED.
The problem is that the code assumes that if the variable is not a pointer, it
cannot be AS_DEFERRED. From trans-array.c's
gfc_conv_array_parameter:
7017 if (!sym->attr.pointer
7018 && sym->as
7019 && sym->as->type != AS_ASSUMED_SHAPE
7020 && sym->as->type != AS_ASSUMED_RANK
7021 && !sym->attr.allocatable)
7022 {
...
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/55134] associate construct and assumed size array
2012-10-30 9:48 [Bug fortran/55134] New: associate construct and assumed size array valeryweber at hotmail dot com
2012-10-30 11:34 ` [Bug fortran/55134] " burnus at gcc dot gnu.org
@ 2012-10-31 17:23 ` burnus at gcc dot gnu.org
2012-10-31 17:24 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-10-31 17:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55134
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-10-31 17:22:36 UTC ---
Author: burnus
Date: Wed Oct 31 17:22:26 2012
New Revision: 193041
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193041
Log:
2012-10-31 Tobias Burnus <burnus@net-b.de>
PR fortran/55134
* trans-array.c (gfc_conv_array_parameter): Regard AS_DEFERRED
* as
array with descriptor.
2012-10-31 Tobias Burnus <burnus@net-b.de>
PR fortran/55134
* gfortran.dg/associate_11.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/associate_11.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-array.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/55134] associate construct and assumed size array
2012-10-30 9:48 [Bug fortran/55134] New: associate construct and assumed size array valeryweber at hotmail dot com
2012-10-30 11:34 ` [Bug fortran/55134] " burnus at gcc dot gnu.org
2012-10-31 17:23 ` burnus at gcc dot gnu.org
@ 2012-10-31 17:24 ` burnus at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-10-31 17:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55134
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-10-31 17:23:52 UTC ---
FIXED on the trunk (4.8).
Thanks for the bug report!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-31 17:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-30 9:48 [Bug fortran/55134] New: associate construct and assumed size array valeryweber at hotmail dot com
2012-10-30 11:34 ` [Bug fortran/55134] " burnus at gcc dot gnu.org
2012-10-31 17:23 ` burnus at gcc dot gnu.org
2012-10-31 17:24 ` burnus 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).