summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-18 22:34:34 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-18 22:34:34 +0000
commitc99a09a45670422ae06fa85333d04ae8648f6784 (patch)
treeade38c5085e9549d56a88b49e9e81a2e8612d7bc /gcc
parentcf028aa992fd55ef59a5287a67f72dc3e858a9af (diff)
downloadppe42-gcc-c99a09a45670422ae06fa85333d04ae8648f6784.tar.gz
ppe42-gcc-c99a09a45670422ae06fa85333d04ae8648f6784.zip
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 Janus Weil <janus@gcc.gnu.org> PR fortran/47789 * gfortran.dg/derived_constructor_comps_4.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170291 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/primary.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/derived_constructor_comps_4.f9018
4 files changed, 35 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2e9fc8c4948..d7dff6d435d 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 c8e2bb6b034..4cda7a183d8 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 f023a37e5b0..54665c4fc45 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 00000000000..e70551838ae
--- /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
OpenPOWER on IntegriCloud