From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1D8A6388B022; Sun, 21 Jun 2020 17:20:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D8A6388B022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1592760009; bh=bJxiO9tXe5wCGgXfruxS6mysuWn25DhkJcHGOYx6h4o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=el0g3mhEikzFx0HVB0MPyhVY6RlMz5RwQL0rKyCVEOcppPfQEMqc40QqHdIM4Gmqa ao2YUkA+KYAKU7iEhlfMlU0QPziQmgXtU8V03yOPxg1qgh2yr5ymhfgNdkaN7PMFU4 BlyapUJ/UoeuZzZHhtLgENQ6+jlJWwEl6/GOFAGw= From: "anlauf at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/50410] [8/9/10/11 Regression] ICE in record_reference, pointer variable in data statement Date: Sun, 21 Jun 2020 17:20:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 7.0 X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: anlauf at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2020 17:20:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D50410 --- Comment #42 from anlauf at gcc dot gnu.org --- (In reply to Dominique d'Humieres from comment #41) > In my working tree I had the following patch This still ICEs on comment#23 z1. Slightly rewriting that case, one gets a reasonable error message: program p type ta integer :: a end type ta type t type(ta), pointer :: b end type t type(t) :: u =3D t(ta(1)) end pr50410_23x.f90:8:19: 8 | type(t) :: u =3D t(ta(1)) | 1 Error: The element in the structure constructor at (1), for pointer compone= nt 'b' should be a POINTER or a TARGET Digging further, one sees that the error is generated for z1 but not emitte= d. The following patch does the magic (not regtested): diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 8daa7bb8d06..0a995ec3ae7 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3087,6 +3087,9 @@ gfc_reduce_init_expr (gfc_expr *expr) t =3D gfc_check_init_expr (expr); gfc_init_expr_flag =3D false; + if (gfc_error_check()) + return false; + if (!t || !expr) return false;=