summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-02 09:43:08 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-02 09:43:08 +0000
commitd57a14220e72765e991e651383bb3fa1e4f4f064 (patch)
treeaaa9b1da048884fee7e274384842fcc7433a0f25
parent20db74cdc161640b99aa69c1ed2fd914341bf4ed (diff)
downloadgcc-d57a14220e72765e991e651383bb3fa1e4f4f064.tar.gz
* decl.c (variable_decl): Reject old style initialization
for derived type components. * gfortran.dg/oldstyle_5.f: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212227 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/decl.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/oldstyle_5.f8
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 5ebf40b3b2e..46ddb8fcfeb 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2014-07-02 Jakub Jelinek <jakub@redhat.com>
+ Fritz Reese <Reese-Fritz@zai.com>
+
+ * decl.c (variable_decl): Reject old style initialization
+ for derived type components.
+
2014-06-29 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/36275
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 7f7428156e3..25d92a46d3e 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1997,6 +1997,13 @@ variable_decl (int elem)
if (!gfc_notify_std (GFC_STD_GNU, "Old-style "
"initialization at %C"))
return MATCH_ERROR;
+ else if (gfc_current_state () == COMP_DERIVED)
+ {
+ gfc_error ("Invalid old style initialization for derived type "
+ "component at %C");
+ m = MATCH_ERROR;
+ goto cleanup;
+ }
return match_old_style_init (name);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b364f407b46..ad46526bad6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-07-02 Jakub Jelinek <jakub@redhat.com>
+ Fritz Reese <Reese-Fritz@zai.com>
+
+ * gfortran.dg/oldstyle_5.f: New test.
+
2014-07-02 Uros Bizjak <ubizjak@gmail.com>
* gfortran.dg/ieee/ieee_1.F90 (dg-additional-options): Remove -O0.
diff --git a/gcc/testsuite/gfortran.dg/oldstyle_5.f b/gcc/testsuite/gfortran.dg/oldstyle_5.f
new file mode 100644
index 00000000000..8a0d3119fb4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/oldstyle_5.f
@@ -0,0 +1,8 @@
+C { dg-do compile }
+ TYPE T
+ INTEGER A(2)/1,2/ ! { dg-error "Invalid old style initialization for derived type component" }
+ END TYPE
+ TYPE S
+ INTEGER B/1/ ! { dg-error "Invalid old style initialization for derived type component" }
+ END TYPE
+ END