* [Bug fortran/102287] optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines.
2021-09-11 0:37 [Bug fortran/102287] New: optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines alipasha.celeris at gmail dot com
@ 2021-09-13 19:37 ` anlauf at gcc dot gnu.org
2021-09-13 20:55 ` anlauf at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-13 19:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102287
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2021-09-13
Status|UNCONFIRMED |NEW
--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/102287] optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines.
2021-09-11 0:37 [Bug fortran/102287] New: optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines alipasha.celeris at gmail dot com
2021-09-13 19:37 ` [Bug fortran/102287] " anlauf at gcc dot gnu.org
@ 2021-09-13 20:55 ` anlauf at gcc dot gnu.org
2021-09-14 19:05 ` anlauf at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-13 20:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102287
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #2 from anlauf at gcc dot gnu.org ---
We need to wrap the deallocation of INTENT(out) allocatable components into
a test for presence, like:
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 18d665192f0..076cffdd77f 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -6548,6 +6548,19 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
// deallocate the components first
tmp = gfc_deallocate_alloc_comp (fsym->ts.u.derived,
parmse.expr, e->rank);
+ /* But check whether dummy argument is optional. */
+ if (tmp != NULL_TREE
+ && fsym->attr.optional
+ && e->expr_type == EXPR_VARIABLE
+ && e->symtree->n.sym->attr.optional)
+ {
+ tree present, notpres;
+ present = gfc_conv_expr_present (e->symtree->n.sym);
+ notpres = build_empty_stmt (input_location);
+ tmp = fold_build3_loc (input_location, COND_EXPR,
+ void_type_node,
+ present, tmp, notpres);
+ }
if (tmp != NULL_TREE)
gfc_add_expr_to_block (&se->pre, tmp);
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/102287] optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines.
2021-09-11 0:37 [Bug fortran/102287] New: optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines alipasha.celeris at gmail dot com
2021-09-13 19:37 ` [Bug fortran/102287] " anlauf at gcc dot gnu.org
2021-09-13 20:55 ` anlauf at gcc dot gnu.org
@ 2021-09-14 19:05 ` anlauf at gcc dot gnu.org
2021-09-16 18:12 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-14 19:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102287
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from anlauf at gcc dot gnu.org ---
Slightly cleaned up and submitted:
https://gcc.gnu.org/pipermail/fortran/2021-September/056522.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/102287] optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines.
2021-09-11 0:37 [Bug fortran/102287] New: optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines alipasha.celeris at gmail dot com
` (2 preceding siblings ...)
2021-09-14 19:05 ` anlauf at gcc dot gnu.org
@ 2021-09-16 18:12 ` cvs-commit at gcc dot gnu.org
2021-09-19 19:19 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-16 18:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102287
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:cfea7b86f2430b9cb8018379b071f4004233119c
commit r12-3584-gcfea7b86f2430b9cb8018379b071f4004233119c
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Sep 16 20:12:21 2021 +0200
Fortran - fix handling of optional allocatable DT arguments with
INTENT(OUT)
gcc/fortran/ChangeLog:
PR fortran/102287
* trans-expr.c (gfc_conv_procedure_call): Wrap deallocation of
allocatable components of optional allocatable derived type
procedure arguments with INTENT(OUT) into a presence check.
gcc/testsuite/ChangeLog:
PR fortran/102287
* gfortran.dg/intent_out_14.f90: New test.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/102287] optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines.
2021-09-11 0:37 [Bug fortran/102287] New: optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines alipasha.celeris at gmail dot com
` (3 preceding siblings ...)
2021-09-16 18:12 ` cvs-commit at gcc dot gnu.org
@ 2021-09-19 19:19 ` cvs-commit at gcc dot gnu.org
2021-09-21 18:51 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-19 19:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102287
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:6527feb07c31689c6d31b7bd16fec9ada691e06b
commit r11-9015-g6527feb07c31689c6d31b7bd16fec9ada691e06b
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Sep 16 20:12:21 2021 +0200
Fortran - fix handling of optional allocatable DT arguments with
INTENT(OUT)
gcc/fortran/ChangeLog:
PR fortran/102287
* trans-expr.c (gfc_conv_procedure_call): Wrap deallocation of
allocatable components of optional allocatable derived type
procedure arguments with INTENT(OUT) into a presence check.
gcc/testsuite/ChangeLog:
PR fortran/102287
* gfortran.dg/intent_out_14.f90: New test.
(cherry picked from commit cfea7b86f2430b9cb8018379b071f4004233119c)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/102287] optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines.
2021-09-11 0:37 [Bug fortran/102287] New: optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines alipasha.celeris at gmail dot com
` (4 preceding siblings ...)
2021-09-19 19:19 ` cvs-commit at gcc dot gnu.org
@ 2021-09-21 18:51 ` cvs-commit at gcc dot gnu.org
2021-09-21 19:06 ` cvs-commit at gcc dot gnu.org
2021-09-21 19:10 ` anlauf at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-21 18:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102287
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:216a4be1cc18119a83df562f7abb3dcebd9ce512
commit r10-10141-g216a4be1cc18119a83df562f7abb3dcebd9ce512
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Sep 16 20:12:21 2021 +0200
Fortran - fix handling of optional allocatable DT arguments with
INTENT(OUT)
gcc/fortran/ChangeLog:
PR fortran/102287
* trans-expr.c (gfc_conv_procedure_call): Wrap deallocation of
allocatable components of optional allocatable derived type
procedure arguments with INTENT(OUT) into a presence check.
gcc/testsuite/ChangeLog:
PR fortran/102287
* gfortran.dg/intent_out_14.f90: New test.
(cherry picked from commit cfea7b86f2430b9cb8018379b071f4004233119c)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/102287] optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines.
2021-09-11 0:37 [Bug fortran/102287] New: optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines alipasha.celeris at gmail dot com
` (5 preceding siblings ...)
2021-09-21 18:51 ` cvs-commit at gcc dot gnu.org
@ 2021-09-21 19:06 ` cvs-commit at gcc dot gnu.org
2021-09-21 19:10 ` anlauf at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-21 19:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102287
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:
https://gcc.gnu.org/g:4210c6c62f6938cd70d768b1bd1ea98d13e3b805
commit r9-9737-g4210c6c62f6938cd70d768b1bd1ea98d13e3b805
Author: Harald Anlauf <anlauf@gmx.de>
Date: Thu Sep 16 20:12:21 2021 +0200
Fortran - fix handling of optional allocatable DT arguments with
INTENT(OUT)
gcc/fortran/ChangeLog:
PR fortran/102287
* trans-expr.c (gfc_conv_procedure_call): Wrap deallocation of
allocatable components of optional allocatable derived type
procedure arguments with INTENT(OUT) into a presence check.
gcc/testsuite/ChangeLog:
PR fortran/102287
* gfortran.dg/intent_out_14.f90: New test.
(cherry picked from commit cfea7b86f2430b9cb8018379b071f4004233119c)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/102287] optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines.
2021-09-11 0:37 [Bug fortran/102287] New: optional allocatable array arguments (intent out) of derived types with allocatable components are not properly passed to subroutines alipasha.celeris at gmail dot com
` (6 preceding siblings ...)
2021-09-21 19:06 ` cvs-commit at gcc dot gnu.org
@ 2021-09-21 19:10 ` anlauf at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-09-21 19:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102287
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #8 from anlauf at gcc dot gnu.org ---
Fixed on all open branches. Closing.
Thanks for the report!
^ permalink raw reply [flat|nested] 9+ messages in thread