public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jamborm at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-110677-4-pVDeAy4kyA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110677-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110677

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pault at gcc dot gnu.org

--- Comment #1 from Martin Jambor <jamborm at gcc dot gnu.org> ---
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 != BT_CHARACTER
+                 || !comp->ts.u.cl
+                 || !comp->ts.u.cl->length
+                 || comp->ts.u.cl->length->expr_type != 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

  reply	other threads:[~2023-07-22 16:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15 19:54 [Bug fortran/110677] New: " jamborm at gcc dot gnu.org
2023-07-22 16:57 ` jamborm at gcc dot gnu.org [this message]
2023-08-14 17:41 ` [Bug fortran/110677] " jamborm at gcc dot gnu.org
2023-08-15 15:15 ` cvs-commit at gcc dot gnu.org
2023-08-15 15:19 ` jamborm at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110677-4-pVDeAy4kyA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).