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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:1fb467dbcc2cdd3bb89fa860a1f86b7e334e0ce3

commit r15-4863-g1fb467dbcc2cdd3bb89fa860a1f86b7e334e0ce3
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Sat Nov 2 18:47:27 2024 +0100

    gimplify: Fix up RAW_DATA_CST related ICE [PR117384]

    Apparently tree_output_constant_def doesn't strictly guarantee that the
    returned VAR_DECL will have the same or uselessly convertible type as
    the type of the constant passed to it, compare_constants says:
     /* For arrays, check that mode, size and storage order match.  */
     /* For record and union constructors, require exact type equality.  */
    The older use of tree_output_constant_def in gimplify.cc was already
    handling this right:
                   ctor = tree_output_constant_def (ctor);
                   if (!useless_type_conversion_p (type, TREE_TYPE (ctor)))
                     ctor = build1 (VIEW_CONVERT_EXPR, type, ctor);
    but the spot I've added for RAW_DATA_CST missed this.

    So, the following patch adds that.

    2024-11-02  Jakub Jelinek  <ja...@redhat.com>

            PR middle-end/117384
            * gimplify.cc (gimplify_init_ctor_eval): Add VIEW_CONVERT_EXPR
around
            rctor if it doesn't have expected type.

            * c-c++-common/init-7.c: New test.

Reply via email to