diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/primary.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/derived_constructor_comps_4.f90 | 18 |
4 files changed, 35 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2e9fc8c..d7dff6d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-02-18 Janus Weil <janus@gcc.gnu.org> + + PR fortran/47789 + * primary.c (gfc_match_structure_constructor): Handle empty parent + types. + 2011-02-18 Tobias Burnus PR fortran/47775 diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index c8e2bb6..4cda7a1 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2310,6 +2310,12 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result, { gfc_component *this_comp = NULL; + if (comp == sym->components && sym->attr.extension + && comp->ts.type == BT_DERIVED + && comp->ts.u.derived->attr.zero_comp) + /* Skip empty parents. */ + comp = comp->next; + if (!comp_head) comp_tail = comp_head = gfc_get_structure_ctor_component (); else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f023a37..54665c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-02-18 Janus Weil <janus@gcc.gnu.org> + + PR fortran/47789 + * gfortran.dg/derived_constructor_comps_4.f90: New. + 2011-02-18 Tobias Burnus PR fortran/47775 diff --git a/gcc/testsuite/gfortran.dg/derived_constructor_comps_4.f90 b/gcc/testsuite/gfortran.dg/derived_constructor_comps_4.f90 new file mode 100644 index 0000000..e705518 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/derived_constructor_comps_4.f90 @@ -0,0 +1,18 @@ +! { dg-do run } +! +! PR 47789: [F03] Structure constructor of type extending DT with no components +! +! Contributed by eddyg_61-bugzilla@yahoo.it + +type:: one +end type + +type, extends(one) :: two + integer :: a +end type + +type(two) :: wo = two(6) + +if (wo%a /= 6) call abort() + +end |