From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3AA96385E451; Sat, 22 Jul 2023 16:57:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AA96385E451 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690045024; bh=LwQDWyY8nYyoxdVPqJvPly04qHRMhrRQ/zOb6Uo1WrY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Jt8zDjky+DxBZ0XVLD5iGG2k19ZobRSIwH1DEQQ8RZJq3o5A21Pg+9IGZmctGvqt7 b8bwL6d4dzYJe3jKqY3cX+tAxFQgAIKv9NxZz4pwviVR+TpH5EFCwPF1tBDZdMtthu vwyLLk0bWePo6DMX5gai18QDXeFssoA8H0eYHcYI= From: "jamborm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/110677] UBSAN error: load of value 1818451807, which is not a valid value for type 'expr_t' when compiling pr49213.f90 Date: Sat, 22 Jul 2023 16:57:02 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jamborm at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110677 Martin Jambor changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pault at gcc dot gnu.org --- Comment #1 from Martin Jambor --- I believe the testcase fails with UBSAN since its introduction in r14-2160-g3521768e8e3c44 (Fortran: Enable class expressions in structure constructors [PR49213]). It can be reproduced without UBSAN by adding an assert like: diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 8e018b6e7e8..66735e163b3 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -1392,6 +1392,10 @@ resolve_structure_cons (gfc_expr *expr, int init) } } + gcc_assert (cons->expr->ts.type !=3D BT_CHARACTER + || !comp->ts.u.cl + || !comp->ts.u.cl->length + || comp->ts.u.cl->length->expr_type !=3D 1818451807); /* For strings, the length of the constructor should be the same as the one of the structure, ensure this if the lengths are known at compile time and when we are dealing with PARAMETER or structure=