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