* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
@ 2012-11-04 18:32 ` janus at gcc dot gnu.org
2012-11-04 22:27 ` janus at gcc dot gnu.org
` (19 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-04 18:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #1 from janus at gcc dot gnu.org 2012-11-04 18:32:29 UTC ---
Patch:
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 193135)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -3771,9 +3771,10 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gf
else
gfc_restore_backend_locus (&loc);
- /* Deallocate when leaving the scope. Nullifying is not
- needed. */
- if (!sym->attr.result && !sym->attr.dummy)
+ /* Automatic deallocation when leaving the scope.
+ Nullifying is not needed. */
+ if (!proc_sym->attr.is_main_program
+ && !sym->attr.result && !sym->attr.dummy)
{
if (sym->ts.type == BT_CLASS
&& CLASS_DATA (sym)->attr.codimension)
This regresses on:
FAIL: gfortran.dg/allocatable_scalar_9.f90 -O0 scan-tree-dump-times original
"__builtin_free" 32
FAIL: gfortran.dg/coarray_lib_alloc_2.f90 -O scan-tree-dump-times original
"_gfortran_caf_deregister .&yy._data.token, 0B, 0B, 0.;" 1
FAIL: gfortran.dg/move_alloc_4.f90 -O0 scan-tree-dump-times original
"__builtin_free" 9
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
2012-11-04 18:32 ` [Bug fortran/55207] " janus at gcc dot gnu.org
@ 2012-11-04 22:27 ` janus at gcc dot gnu.org
2012-11-04 22:48 ` janus at gcc dot gnu.org
` (18 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-04 22:27 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #2 from janus at gcc dot gnu.org 2012-11-04 22:26:44 UTC ---
(In reply to comment #1)
> Patch:
Note: The patch in comment 1 only fixes the auto-deallocation for scalars.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
2012-11-04 18:32 ` [Bug fortran/55207] " janus at gcc dot gnu.org
2012-11-04 22:27 ` janus at gcc dot gnu.org
@ 2012-11-04 22:48 ` janus at gcc dot gnu.org
2012-11-05 9:07 ` janus at gcc dot gnu.org
` (17 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-04 22:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #3 from janus at gcc dot gnu.org 2012-11-04 22:48:37 UTC ---
The following patch applies the implicit SAVE attribute to variables declared
in the main program:
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 193137)
+++ gcc/fortran/decl.c (working copy)
@@ -3812,9 +3812,11 @@ match_attr_spec (void)
}
}
- /* Since Fortran 2008 module variables implicitly have the SAVE attribute.
*/
- if (gfc_current_state () == COMP_MODULE && !current_attr.save
- && (gfc_option.allow_std & GFC_STD_F2008) != 0)
+ /* Since Fortran 2008, variables declared in a MODULE or PROGRAM
+ implicitly have the SAVE attribute. */
+ if ((gfc_current_state () == COMP_MODULE
+ || gfc_current_state () == COMP_PROGRAM)
+ && !current_attr.save && (gfc_option.allow_std & GFC_STD_F2008) != 0)
current_attr.save = SAVE_IMPLICIT;
colon_seen = 1;
This also removes the automatic allocation of both variables in the test case
in comment 0. Therefore it has the same testsuite failures as the patch in
comment 1 (possibly more?).
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (2 preceding siblings ...)
2012-11-04 22:48 ` janus at gcc dot gnu.org
@ 2012-11-05 9:07 ` janus at gcc dot gnu.org
2012-11-05 9:37 ` janus at gcc dot gnu.org
` (16 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-05 9:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #4 from janus at gcc dot gnu.org 2012-11-05 09:07:23 UTC ---
(In reply to comment #3)
> Therefore it has the same testsuite failures as the patch in
> comment 1 (possibly more?).
Indeed it has a few more ...
FAIL: gfortran.dg/alloc_comp_basics_1.f90 -O0 scan-tree-dump-times original
"builtin_free" 18
FAIL: gfortran.dg/alloc_comp_constructor_1.f90 -O0 scan-tree-dump-times
original "builtin_free" 19
FAIL: gfortran.dg/allocatable_scalar_9.f90 -O0 scan-tree-dump-times original
"__builtin_free" 32
FAIL: gfortran.dg/auto_dealloc_2.f90 -O scan-tree-dump-times original
"__builtin_free" 3
FAIL: gfortran.dg/coarray_lib_alloc_2.f90 -O scan-tree-dump-times original
"_gfortran_caf_deregister .&yy._data.token, 0B, 0B, 0.;" 1
FAIL: gfortran.dg/intent_optimize_1.f90 -O scan-tree-dump-times optimized
"does_not_exist" 0
FAIL: gfortran.dg/storage_size_3.f08 -O0 execution test
FAIL: gfortran.dg/extends_14.f03 -O scan-tree-dump-times original
"__builtin_free" 3
FAIL: gfortran.dg/volatile4.f90 -O scan-tree-dump-not optimized
"NonVolatileNotOptimizedAway"
FAIL: gfortran.dg/volatile6.f90 -O scan-tree-dump-not optimized
"NonVolatileNotOptimizedAway1"
FAIL: gfortran.dg/move_alloc_4.f90 -O0 scan-tree-dump-times original
"__builtin_free" 9
FAIL: gfortran.dg/typebound_proc_27.f03 -O0 scan-tree-dump-times original
"__builtin_free" 7
Most of them seem to be scan-tree-dump failures, except for:
FAIL: gfortran.dg/storage_size_3.f08 -O0 execution test
which apparently segfaults at runtime (invalid memory reference).
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (3 preceding siblings ...)
2012-11-05 9:07 ` janus at gcc dot gnu.org
@ 2012-11-05 9:37 ` janus at gcc dot gnu.org
2012-11-05 17:45 ` janus at gcc dot gnu.org
` (15 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-05 9:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #5 from janus at gcc dot gnu.org 2012-11-05 09:37:20 UTC ---
(In reply to comment #4)
> Most of them seem to be scan-tree-dump failures, except for:
>
> FAIL: gfortran.dg/storage_size_3.f08 -O0 execution test
>
> which apparently segfaults at runtime (invalid memory reference).
This is due to missing vptr initialization of the variable 'y':
class(t), allocatable :: y
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (4 preceding siblings ...)
2012-11-05 9:37 ` janus at gcc dot gnu.org
@ 2012-11-05 17:45 ` janus at gcc dot gnu.org
2013-07-22 11:01 ` janus at gcc dot gnu.org
` (14 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2012-11-05 17:45 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #6 from janus at gcc dot gnu.org 2012-11-05 17:45:23 UTC ---
Created attachment 28620
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28620
patch
Here is an extended patch, based on comment 3, which fixes the storage_size_3
wrong-code problem (cf. gfc_trans_deferred_vars) and corrects the
__builtin_free counts in the test cases.
It still fails on the following:
FAIL: gfortran.dg/c_ptr_tests_16.f90 -O scan-tree-dump-times optimized
"i_do_not_exist" 0
FAIL: gfortran.dg/coarray_lib_alloc_2.f90 -O scan-tree-dump-times original
"_gfortran_caf_deregister .&xx._data.token, 0B, 0B, 0.;" 1
FAIL: gfortran.dg/intent_optimize_1.f90 -O scan-tree-dump-times optimized
"does_not_exist" 0
FAIL: gfortran.dg/volatile4.f90 -O scan-tree-dump-not optimized
"NonVolatileNotOptimizedAway"
FAIL: gfortran.dg/volatile6.f90 -O scan-tree-dump-not optimized
"NonVolatileNotOptimizedAway1"
Except for one coarray issue, those seem to be problems with optimizing away
stuff in certain situations (I haven't checked any details yet).
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (5 preceding siblings ...)
2012-11-05 17:45 ` janus at gcc dot gnu.org
@ 2013-07-22 11:01 ` janus at gcc dot gnu.org
2013-07-31 20:43 ` janus at gcc dot gnu.org
` (13 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2013-07-22 11:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from janus at gcc dot gnu.org ---
I think this PR has been fixed by r199643.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (6 preceding siblings ...)
2013-07-22 11:01 ` janus at gcc dot gnu.org
@ 2013-07-31 20:43 ` janus at gcc dot gnu.org
2013-08-01 14:58 ` janus at gcc dot gnu.org
` (12 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2013-07-31 20:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Last reconfirmed| |2013-07-31
Resolution|FIXED |---
Ever confirmed|0 |1
--- Comment #8 from janus at gcc dot gnu.org ---
(In reply to janus from comment #7)
> I think this PR has been fixed by r199643.
Reopening. Auto-dealloc has indeed been fixed by the above commit. However,
variables in the main program are still not SAVE_IMPLICIT, which makes problems
e.g. in PR 57306.
I think we need the patch in comment 6 after all. But how do we get rid of the
remaining regressions?
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (7 preceding siblings ...)
2013-07-31 20:43 ` janus at gcc dot gnu.org
@ 2013-08-01 14:58 ` janus at gcc dot gnu.org
2013-08-01 15:02 ` janus at gcc dot gnu.org
` (11 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-01 14:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #9 from janus at gcc dot gnu.org ---
(In reply to janus from comment #8)
> I think we need the patch in comment 6 after all. But how do we get rid of
> the remaining regressions?
Simplest solution: Move the code in these test cases from the main program into
a subroutine (or similar). Then the variables will not be SAVEd and all
optimizations can be applied as before. (However, it's a bit unfortunate that
we lose the possibility to do these optimizations in the main program.)
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (8 preceding siblings ...)
2013-08-01 14:58 ` janus at gcc dot gnu.org
@ 2013-08-01 15:02 ` janus at gcc dot gnu.org
2013-08-06 8:29 ` janus at gcc dot gnu.org
` (10 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-01 15:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #28620|0 |1
is obsolete| |
--- Comment #10 from janus at gcc dot gnu.org ---
Created attachment 30584
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30584&action=edit
new patch
Here is a new version of the patch which regtests cleanly.
The trans-decl.c parts are not strictly necessary. They just do some clean-up.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] Automatic deallocation of variables declared in the main program
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (9 preceding siblings ...)
2013-08-01 15:02 ` janus at gcc dot gnu.org
@ 2013-08-06 8:29 ` janus at gcc dot gnu.org
2013-12-18 11:46 ` [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute janus at gcc dot gnu.org
` (9 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2013-08-06 8:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #13 from janus at gcc dot gnu.org ---
Test case from PR 57306 comment 7 (see also
http://gcc.gnu.org/ml/fortran/2013-07/msg00103.html):
type :: c
end type c
type(c), target :: x
class(c), pointer :: px => x
if (.not. associated(px)) call abort()
end
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (10 preceding siblings ...)
2013-08-06 8:29 ` janus at gcc dot gnu.org
@ 2013-12-18 11:46 ` janus at gcc dot gnu.org
2014-03-15 10:53 ` janus at gcc dot gnu.org
` (8 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2013-12-18 11:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (11 preceding siblings ...)
2013-12-18 11:46 ` [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute janus at gcc dot gnu.org
@ 2014-03-15 10:53 ` janus at gcc dot gnu.org
2014-03-15 11:12 ` dominiq at lps dot ens.fr
` (7 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-15 10:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #14 from janus at gcc dot gnu.org ---
Author: janus
Date: Sat Mar 15 10:53:04 2014
New Revision: 208590
URL: http://gcc.gnu.org/viewcvs?rev=208590&root=gcc&view=rev
Log:
2014-03-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/55207
* decl.c (match_attr_spec): Variables in the main program implicitly
get the SAVE attribute in Fortran 2008.
2014-03-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/55207
* gfortran.dg/assumed_rank_7.f90: Explicitly deallocate variables.
* gfortran.dg/c_ptr_tests_16.f90: Put into subroutine.
* gfortran.dg/inline_sum_bounds_check_1.f90: Add
-Wno-aggressive-loop-optimizations and remove an unused variable.
* gfortran.dg/intent_optimize_1.f90: Put into subroutine.
* gfortran.dg/pointer_init_9.f90: New.
* gfortran.dg/volatile4.f90: Put into subroutine.
* gfortran.dg/volatile6.f90: Ditto.
Added:
trunk/gcc/testsuite/gfortran.dg/pointer_init_9.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/assumed_rank_7.f90
trunk/gcc/testsuite/gfortran.dg/c_ptr_tests_16.f90
trunk/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90
trunk/gcc/testsuite/gfortran.dg/intent_optimize_1.f90
trunk/gcc/testsuite/gfortran.dg/volatile4.f90
trunk/gcc/testsuite/gfortran.dg/volatile6.f90
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (12 preceding siblings ...)
2014-03-15 10:53 ` janus at gcc dot gnu.org
@ 2014-03-15 11:12 ` dominiq at lps dot ens.fr
2014-03-15 12:14 ` janus at gcc dot gnu.org
` (6 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-15 11:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #15 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
*** Bug 55887 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (13 preceding siblings ...)
2014-03-15 11:12 ` dominiq at lps dot ens.fr
@ 2014-03-15 12:14 ` janus at gcc dot gnu.org
2014-03-18 22:15 ` janus at gcc dot gnu.org
` (5 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-15 12:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #16 from janus at gcc dot gnu.org ---
Fixed with r208590. Closing.
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (14 preceding siblings ...)
2014-03-15 12:14 ` janus at gcc dot gnu.org
@ 2014-03-18 22:15 ` janus at gcc dot gnu.org
2014-03-18 22:23 ` janus at gcc dot gnu.org
` (4 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-18 22:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #17 from janus at gcc dot gnu.org ---
Author: janus
Date: Tue Mar 18 22:15:10 2014
New Revision: 208668
URL: http://gcc.gnu.org/viewcvs?rev=208668&root=gcc&view=rev
Log:
2014-03-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/55207
PR fortran/60549
* decl.c (match_attr_spec): Revert r208590.
2014-03-18 Janus Weil <janus@gcc.gnu.org>
PR fortran/55207
PR fortran/60549
* gfortran.dg/assumed_rank_7.f90: Revert r208590.
* gfortran.dg/c_ptr_tests_16.f90: Ditto.
* gfortran.dg/inline_sum_bounds_check_1.f90: Ditto.
* gfortran.dg/intent_optimize_1.f90: Ditto.
* gfortran.dg/pointer_init_9.f90: Ditto.
* gfortran.dg/volatile4.f90: Ditto.
* gfortran.dg/volatile6.f90: Ditto.
Removed:
trunk/gcc/testsuite/gfortran.dg/pointer_init_9.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/decl.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gfortran.dg/assumed_rank_7.f90
trunk/gcc/testsuite/gfortran.dg/c_ptr_tests_16.f90
trunk/gcc/testsuite/gfortran.dg/inline_sum_bounds_check_1.f90
trunk/gcc/testsuite/gfortran.dg/intent_optimize_1.f90
trunk/gcc/testsuite/gfortran.dg/volatile4.f90
trunk/gcc/testsuite/gfortran.dg/volatile6.f90
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (15 preceding siblings ...)
2014-03-18 22:15 ` janus at gcc dot gnu.org
@ 2014-03-18 22:23 ` janus at gcc dot gnu.org
2015-10-21 10:32 ` jb at gcc dot gnu.org
` (3 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: janus at gcc dot gnu.org @ 2014-03-18 22:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #18 from janus at gcc dot gnu.org ---
Reopening. The patch has been reverted due to the problems mentioned in
http://gcc.gnu.org/ml/fortran/2014-03/msg00108.html
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (16 preceding siblings ...)
2014-03-18 22:23 ` janus at gcc dot gnu.org
@ 2015-10-21 10:32 ` jb at gcc dot gnu.org
2023-03-18 17:40 ` pault at gcc dot gnu.org
` (2 subsequent siblings)
20 siblings, 0 replies; 22+ messages in thread
From: jb at gcc dot gnu.org @ 2015-10-21 10:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
Janne Blomqvist <jb at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jb at gcc dot gnu.org
--- Comment #19 from Janne Blomqvist <jb at gcc dot gnu.org> ---
As was mentioned recently on comp.lang.fortran, this affects OpenMP. Consider
program teste_paralelo
use omp_lib
real :: v1(12,60,60,60,2)
!$omp parallel do
do kk=2,60
v1(5,2,2,kk,1)=0
enddo
!$omp end parallel do
!$omp parallel
print *, 'Hello World!'
!$omp end parallel
end program teste_paralelo
Compiling without OpenMP and checking the binary with size, the array v1 is
allocated statically in the bss section:
$ gfortran -g teste_paralelo.f90 -o test-serial
$ size test-serial
text data bss dec hex filename
2147 608 20736032 20738787 13c72e3 test-serial
Enabling openmp, the array suddenly goes on the stack:
$ gfortran -g -fopenmp teste_paralelo.f90 -o test
$ size test
text data bss dec hex filename
2822 656 8 3486 d9e test
If one manually makes v1 saved, it naturally goes into the bss with openmp too:
$ gfortran -g -fopenmp teste_paralelo.f90 -o test-save
$ size test-save
text data bss dec hex filename
2790 656 20736032 20739478 13c7596 test-save
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (17 preceding siblings ...)
2015-10-21 10:32 ` jb at gcc dot gnu.org
@ 2023-03-18 17:40 ` pault at gcc dot gnu.org
2023-03-18 17:40 ` pault at gcc dot gnu.org
2023-05-02 13:23 ` burnus at gcc dot gnu.org
20 siblings, 0 replies; 22+ messages in thread
From: pault at gcc dot gnu.org @ 2023-03-18 17:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
Blocks|37336, 78122 |
--- Comment #22 from Paul Thomas <pault at gcc dot gnu.org> ---
As far as I am aware, this bug has either been fixed or has been worked round
everywhere. However, it doesn't block PR37336 and so I am releasing that
dependency.
Cheers
Paul
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37336
[Bug 37336] [F03] Finish derived-type finalization
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78122
[Bug 78122] [5/6/7/8 Regression] [F08] ICE in get, at cgraph.h:395
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (18 preceding siblings ...)
2023-03-18 17:40 ` pault at gcc dot gnu.org
@ 2023-03-18 17:40 ` pault at gcc dot gnu.org
2023-05-02 13:23 ` burnus at gcc dot gnu.org
20 siblings, 0 replies; 22+ messages in thread
From: pault at gcc dot gnu.org @ 2023-03-18 17:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #23 from Paul Thomas <pault at gcc dot gnu.org> ---
As far as I am aware, this bug has either been fixed or has been worked round
everywhere. However, it doesn't block PR37336 and so I am releasing that
dependency.
Cheers
Paul
^ permalink raw reply [flat|nested] 22+ messages in thread
* [Bug fortran/55207] [F08] Variables declared in the main program should implicitly get the SAVE attribute
2012-11-04 18:27 [Bug fortran/55207] New: Automatic deallocation of variables declared in the main program janus at gcc dot gnu.org
` (19 preceding siblings ...)
2023-03-18 17:40 ` pault at gcc dot gnu.org
@ 2023-05-02 13:23 ` burnus at gcc dot gnu.org
20 siblings, 0 replies; 22+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-05-02 13:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55207
--- Comment #24 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 54968
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54968&action=edit
WIP patch – still many testcase fails
Patch to fixes some MODULE and PROGRAM issues with automatic save.
TODO:
(a) Fix testsuite fails (required)
[(b) Anything to do for COMMON or DATA blocks?]
(c) as follow up, cleanup code for no-longer needed checks (can be follow up)
^ permalink raw reply [flat|nested] 22+ messages in thread