From: Jakub Jelinek Date: Wed, 2 Jul 2014 09:48:56 +0000 (+0200) Subject: decl.c (variable_decl): Reject old style initialization for derived type components. X-Git-Tag: releases/gcc-4.8.4~378 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d31bad838f2e323b67ad0f92fa79fcb6efd0884;p=thirdparty%2Fgcc.git decl.c (variable_decl): Reject old style initialization for derived type components. * decl.c (variable_decl): Reject old style initialization for derived type components. * gfortran.dg/oldstyle_5.f: New test. Co-Authored-By: Fritz Reese From-SVN: r212229 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8033c7a5cc29..65cfa6ffe936 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2014-07-02 Jakub Jelinek + Fritz Reese + + * decl.c (variable_decl): Reject old style initialization + for derived type components. + 2014-06-15 Francois-Xavier Coudert Backport from trunk. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 7dec803a36d5..9292418adcaa 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1996,6 +1996,13 @@ variable_decl (int elem) if (gfc_notify_std (GFC_STD_GNU, "Old-style " "initialization at %C") == FAILURE) 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 8ccfcfedb8f7..facd6dd0c2d6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-07-02 Jakub Jelinek + Fritz Reese + + * gfortran.dg/oldstyle_5.f: New test. + 2014-06-30 Thomas Preud'homme Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/oldstyle_5.f b/gcc/testsuite/gfortran.dg/oldstyle_5.f new file mode 100644 index 000000000000..8a0d3119fb48 --- /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