From: Steven G. Kargl Date: Wed, 12 Dec 2018 00:53:08 +0000 (+0000) Subject: re PR fortran/88155 (ICE in gfc_format_decoder, at fortran/error.c:947) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2f00fb3d0ba1174dee21c33162a5fdc4e583a061;p=gcc.git re PR fortran/88155 (ICE in gfc_format_decoder, at fortran/error.c:947) 2018-12-11 Steven G. Kargl PR fortran/88155 * primary.c (gfc_match_structure_constructor): Set the locus of an expression to avoid a NULL pointer dereference. 2018-12-11 Steven G. Kargl PR fortran/88155 * gfortran.dg/pr70870_1.f90: Update testcase to use -std=gnu. * gfortran.dg/pr88155.f90: New test. From-SVN: r267041 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 945bb23e369..78fe19a6736 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-12-11 Steven G. Kargl + + PR fortran/88155 + * primary.c (gfc_match_structure_constructor): Set the locus of + an expression to avoid a NULL pointer dereference. + 2018-12-11 Steven G. Kargl PR fortran/88249 diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index d94a5c48adf..52cc2f17cd4 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -3212,6 +3212,7 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) e = gfc_get_expr (); e->symtree = symtree; e->expr_type = EXPR_FUNCTION; + e->where = gfc_current_locus; gcc_assert (gfc_fl_struct (sym->attr.flavor) && symtree->n.sym->attr.flavor == FL_PROCEDURE); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c04149484c..bfe527a7ad7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-12-11 Steven G. Kargl + + PR fortran/88155 + * gfortran.dg/pr70870_1.f90: Update testcase to use -std=gnu. + * gfortran.dg/pr88155.f90: New test. + 2018-12-11 Steven G. Kargl PR fortran/88249 diff --git a/gcc/testsuite/gfortran.dg/pr70870_1.f90 b/gcc/testsuite/gfortran.dg/pr70870_1.f90 index 0f9584a36db..eeec92143f4 100644 --- a/gcc/testsuite/gfortran.dg/pr70870_1.f90 +++ b/gcc/testsuite/gfortran.dg/pr70870_1.f90 @@ -1,4 +1,5 @@ ! { dg-do compile } +! { dg-options "-std=gnu" } ! PR fortran/70870 ! Contributed by Vittorio Zecca type t diff --git a/gcc/testsuite/gfortran.dg/pr88155.f90 b/gcc/testsuite/gfortran.dg/pr88155.f90 new file mode 100644 index 00000000000..e10eaca2ba6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr88155.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +program p + type t + integer :: a + end type + type(t) :: x + data x /t()1/ ! { dg-error "No initializer for component" } + print *, x +end