Message ID | 20140702074818.GU31640@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On Wed, Jul 02, 2014 at 09:48:18AM +0200, Jakub Jelinek wrote: > Hi! > > As the testcase shows, we ICE on old style initialization of derived type > components. ifort also rejects these, I think it doesn't make sense to > support such initializations of derived type components. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.9? > Yes.
--- gcc/fortran/decl.c.jj 2014-06-30 09:28:50.000000000 +0200 +++ gcc/fortran/decl.c 2014-07-01 16:47:19.466050044 +0200 @@ -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); } --- gcc/testsuite/gfortran.dg/oldstyle_5.f.jj 2014-07-01 16:50:40.449001427 +0200 +++ gcc/testsuite/gfortran.dg/oldstyle_5.f 2014-07-01 16:48:33.000000000 +0200 @@ -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