Fix initialization of UNIONs with -finit-derived.
authorFritz Reese <fritzoreese@gmail.com>
Thu, 27 Oct 2016 17:21:46 +0000 (17:21 +0000)
committerFritz Reese <foreese@gcc.gnu.org>
Thu, 27 Oct 2016 17:21:46 +0000 (17:21 +0000)
commitf8da53e09357859d707925e770348636b19206a7
tree0ced59424def8217861da26fe0ebd3ed918a6110
parent959c1e20455870ffb01ec67d50b88918a74e9e85
Fix initialization of UNIONs with -finit-derived.

gcc/fortran/
* expr.c (generate_union_initializer, get_union_initializer): New.
* expr.c (component_initializer): Consider BT_UNION specially.
* resolve.c (resolve_structure_cons): Hack for BT_UNION.
* trans-expr.c (gfc_trans_subcomponent_assign): Ditto.
* trans-expr.c (gfc_conv_union_initializer): New.
* trans-expr.c (gfc_conv_structure): Replace UNION handling code with
new function gfc_conv_union_initializer.

gcc/testsuite/gfortran.dg/
* dec_init_1.f90, dec_init_2.f90: Remove -fdump-tree-original.
* dec_init_3.f90, dec_init_4.f90: New tests.

From-SVN: r241626
gcc/fortran/ChangeLog
gcc/fortran/expr.c
gcc/fortran/resolve.c
gcc/fortran/trans-expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/dec_init_1.f90
gcc/testsuite/gfortran.dg/dec_init_2.f90
gcc/testsuite/gfortran.dg/dec_init_3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/dec_init_4.f90 [new file with mode: 0644]