* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
@ 2010-01-09 17:35 ` burnus at gcc dot gnu dot org
2010-01-09 21:29 ` burnus at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-09 17:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from burnus at gcc dot gnu dot org 2010-01-09 17:34 -------
Created an attachment (id=19524)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19524&action=view)
Patch - fixes also use-assoc sllocatable scalars
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |burnus at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
2010-01-09 17:35 ` [Bug fortran/42647] " burnus at gcc dot gnu dot org
@ 2010-01-09 21:29 ` burnus at gcc dot gnu dot org
2010-01-09 21:30 ` burnus at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-09 21:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from burnus at gcc dot gnu dot org 2010-01-09 21:29 -------
And of cause it still does not work:
module m
type st
integer , allocatable :: a1
end type st
type at
integer , allocatable :: a2(:)
end type at
type t1
type(st), allocatable :: b1
end type t1
type t2
type(st), allocatable :: b2(:)
end type t2
type t3
type(at), allocatable :: b3
end type t3
type t4
type(at), allocatable :: b4(:)
end type t4
end module m
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
2010-01-09 17:35 ` [Bug fortran/42647] " burnus at gcc dot gnu dot org
2010-01-09 21:29 ` burnus at gcc dot gnu dot org
@ 2010-01-09 21:30 ` burnus at gcc dot gnu dot org
2010-01-10 15:37 ` dominiq at lps dot ens dot fr
` (7 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-09 21:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2010-01-09 21:30 -------
use m
type(t1) :: na1, a1, aa1(:)
type(t2) :: na2, a2, aa2(:)
type(t3) :: na3, a3, aa3(:)
type(t4) :: na4, a4, aa4(:)
allocatable :: a1, a2, a3, a4, aa1, aa2, aa3,aa4
if(allocated(a1)) call abort()
if(allocated(a2)) call abort()
if(allocated(a3)) call abort()
if(allocated(a4)) call abort()
if(allocated(aa1)) call abort()
if(allocated(aa2)) call abort()
if(allocated(aa3)) call abort()
if(allocated(aa4)) call abort()
if(allocated(na1%b1)) call abort()
if(allocated(na2%b2)) call abort()
if(allocated(na3%b3)) call abort()
if(allocated(na4%b4)) call abort()
end
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
` (2 preceding siblings ...)
2010-01-09 21:30 ` burnus at gcc dot gnu dot org
@ 2010-01-10 15:37 ` dominiq at lps dot ens dot fr
2010-01-27 10:48 ` burnus at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-01-10 15:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dominiq at lps dot ens dot fr 2010-01-10 15:36 -------
The patch in comment #1 fixes the test in comment#0, bootstrapped, regtested,
and passed my tests.
I have split the tests in comment#2 and #3 in two:
module m
type st
integer , allocatable :: a1
end type st
type at
integer , allocatable :: a2(:)
end type at
type t1
type(st), allocatable :: b1
end type t1
type t3
type(at), allocatable :: b3
end type t3
end module m
use m
type(t1) :: na1, a1, aa1(:)
type(t3) :: na3, a3, aa3(:)
allocatable :: a1, a3, aa1, aa3
if(allocated(a1)) call abort()
if(allocated(a3)) call abort()
if(allocated(aa1)) call abort()
if(allocated(aa3)) call abort()
if(allocated(na1%b1)) call abort()
if(allocated(na3%b3)) call abort()
print *, 'end'
end
and
module m
type st
integer , allocatable :: a1
end type st
type at
integer , allocatable :: a2(:)
end type at
type t2
type(st), allocatable :: b2(:)
end type t2
type t4
type(at), allocatable :: b4(:)
end type t4
end module m
use m
type(t2) :: na2, a2, aa2(:)
type(t4) :: na4, a4, aa4(:)
allocatable :: a2, a4, aa2, aa4
!if(allocated(a2)) call abort()
!if(allocated(a4)) call abort()
if(allocated(aa2)) call abort()
if(allocated(aa4)) call abort()
if(allocated(na2%b2)) call abort()
if(allocated(na4%b4)) call abort()
print *, 'end'
end
As such, both pass with the patch, while the first one gives a "Segmentation
fault" before the print without the patch (the second pass). If I remove one of
the '!', the test fails with "Segmentation fault" AFTER the print with or
without the patch.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
` (3 preceding siblings ...)
2010-01-10 15:37 ` dominiq at lps dot ens dot fr
@ 2010-01-27 10:48 ` burnus at gcc dot gnu dot org
2010-05-15 21:25 ` dominiq at lps dot ens dot fr
` (5 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-27 10:48 UTC (permalink / raw)
To: gcc-bugs
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|burnus at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |UNCONFIRMED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
` (4 preceding siblings ...)
2010-01-27 10:48 ` burnus at gcc dot gnu dot org
@ 2010-05-15 21:25 ` dominiq at lps dot ens dot fr
2010-05-15 22:03 ` janus at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-05-15 21:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dominiq at lps dot ens dot fr 2010-05-15 21:25 -------
See also pr44154.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
` (5 preceding siblings ...)
2010-05-15 21:25 ` dominiq at lps dot ens dot fr
@ 2010-05-15 22:03 ` janus at gcc dot gnu dot org
2010-05-15 22:17 ` janus at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-05-15 22:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from janus at gcc dot gnu dot org 2010-05-15 22:03 -------
Subject: Bug 42647
Author: janus
Date: Sat May 15 22:03:09 2010
New Revision: 159445
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159445
Log:
2010-05-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/44154
PR fortran/42647
* trans-decl.c (gfc_trans_deferred_vars): Modify ordering of
if branches.
2010-05-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/44154
PR fortran/42647
* gfortran.dg/allocatable_scalar_9.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/allocatable_scalar_9.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/trans-decl.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
` (6 preceding siblings ...)
2010-05-15 22:03 ` janus at gcc dot gnu dot org
@ 2010-05-15 22:17 ` janus at gcc dot gnu dot org
2010-05-15 22:29 ` janus at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-05-15 22:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from janus at gcc dot gnu dot org 2010-05-15 22:16 -------
r159445 should fix all the initialization trouble. Comment #2/#3 has been
included as a test case.
For the automatic deallocation there is be a problem remaining:
In comment #0, "a" itself is now automatically deallocated, but not "a%d" any
more.
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-05-15 22:16:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
` (7 preceding siblings ...)
2010-05-15 22:17 ` janus at gcc dot gnu dot org
@ 2010-05-15 22:29 ` janus at gcc dot gnu dot org
2010-05-16 14:40 ` dominiq at lps dot ens dot fr
2010-09-02 14:49 ` dominiq at lps dot ens dot fr
10 siblings, 0 replies; 13+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-05-15 22:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from janus at gcc dot gnu dot org 2010-05-15 22:29 -------
(In reply to comment #7)
> For the automatic deallocation there is be a problem remaining:
>
> In comment #0, "a" itself is now automatically deallocated, but not "a%d" any
> more.
This is fixed by this patchlet (which is part of patch in comment #1):
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 159445)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -3272,6 +3272,9 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tr
gfc_se se;
stmtblock_t block;
+ if (sym_has_alloc_comp)
+ fnbody = gfc_trans_deferred_array (sym, fnbody);
+
e = gfc_lval_expr_from_sym (sym);
if (sym->ts.type == BT_CLASS)
gfc_add_component_ref (e, "$data");
Also the use-association issue still needs to be taken care of.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
` (8 preceding siblings ...)
2010-05-15 22:29 ` janus at gcc dot gnu dot org
@ 2010-05-16 14:40 ` dominiq at lps dot ens dot fr
2010-09-02 14:49 ` dominiq at lps dot ens dot fr
10 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-05-16 14:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from dominiq at lps dot ens dot fr 2010-05-16 14:40 -------
(In reply to comment #8)
> This is fixed by this patchlet (which is part of patch in comment #1):
This patch breaks gfortran.dg/allocatable_scalar_9.f90 (Segmentation fault) and
some variants I have in my tests.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug fortran/42647] Missed initialization/dealloc of allocatable scalar DT with allocatable component
2010-01-07 16:04 [Bug fortran/42647] New: Missed initialization/dealloc of allocatable scalar DT with allocatable component burnus at gcc dot gnu dot org
` (9 preceding siblings ...)
2010-05-16 14:40 ` dominiq at lps dot ens dot fr
@ 2010-09-02 14:49 ` dominiq at lps dot ens dot fr
10 siblings, 0 replies; 13+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-09-02 14:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from dominiq at lps dot ens dot fr 2010-09-02 14:49 -------
The tests in the different comments seem to pass since some time.
The behavior of the derived test
module m
type st
integer , allocatable :: c1
end type st
type t1
type(st), allocatable :: b1
end type t1
end module m
use m
type(t1) :: a1, aa1(:)
allocatable :: a1, aa1
if(allocated(a1)) call abort()
if(allocated(aa1)) call abort()
print *, 'now allocate'
allocate(a1, a1%b1, a1%b1%c1)
print *, allocated(a1), allocated(a1%b1), allocated(a1%b1%c1)
a1%b1%c1 = 1
print *, a1%b1%c1
deallocate(a1%b1%c1)
print *, allocated(a1), allocated(a1%b1), allocated(a1%b1%c1)
deallocate(a1%b1)
end
has changed with r163744. Before one got
[macbook] f90/bug% a.out
now allocate
Segmentation fault
Now I get:
[macbook] f90/bug% a.out
now allocate
T T T
1
T T F
At line 25 of file pr42647_1_pass_1_red_1.f90
Fortran runtime error: Attempt to DEALLOCATE unallocated 'a1'
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42647
^ permalink raw reply [flat|nested] 13+ messages in thread