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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <uec...@gcc.gnu.org>:

https://gcc.gnu.org/g:4e6bf0b9dd5585df1a1472d6a93b9fff72fe2524

commit r12-5338-g4e6bf0b9dd5585df1a1472d6a93b9fff72fe2524
Author: Martin Uecker <uec...@gcc.gnu.org>
Date:   Wed Nov 17 14:20:59 2021 +0100

    Fix ICE when mixing VLAs and statement expressions [PR91038]

    When returning VM-types from statement expressions, this can
    lead to an ICE when declarations from the statement expression
    are referred to later. Most of these issues can be addressed by
    gimplifying the base expression earlier in gimplify_compound_lval.
    Another issue is fixed by wrapping the pointer expression in
    pointer_int_sum. This fixes PR91038 and some of the test cases
    from PR29970 (structs with VLA members need further work).

    gcc/
            PR c/91038
            PR c/29970
            * gimplify.c (gimplify_var_or_parm_decl): Update comment.
            (gimplify_compound_lval): Gimplify base expression first.
            (gimplify_target_expr): Add comment.

    gcc/c-family/
            PR c/91038
            PR c/29970
            * c-common.c (pointer_int_sum): Make sure pointer expressions
            are evaluated first when the size expression depends on for
            variably-modified types.

    gcc/testsuite/
            PR c/91038
            PR c/29970
            * gcc.dg/vla-stexp-3.c: New test.
            * gcc.dg/vla-stexp-4.c: New test.
            * gcc.dg/vla-stexp-5.c: New test.
            * gcc.dg/vla-stexp-6.c: New test.
            * gcc.dg/vla-stexp-7.c: New test.
            * gcc.dg/vla-stexp-8.c: New test.
            * gcc.dg/vla-stexp-9.c: New test.

Reply via email to