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

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <[email protected]>:

https://gcc.gnu.org/g:5175ef7f7577a1ef4151f306161a1dab904f23bb

commit r16-4919-g5175ef7f7577a1ef4151f306161a1dab904f23bb
Author: Martin Uecker <[email protected]>
Date:   Fri Oct 31 16:10:40 2025 +0100

    c: Fix ICE when using va_arg with arrays [PR97986]

    When array type is passed to va_arg, this is undefined behavior.
    Emit a warning, and insert a run-time trap after evaluating side effects,
    but return the correct type for sizeof / typeof.  For C90 a VLA is an
    error.

            PR c/97986

    gcc/c/ChangeLog:
            * c-parser.cc (c_parser_postfix_expression): Adapt.
            * c-tree.h (c_build_va_arg): Adapt prototype.
            * c-typeck.cc (c_build_va_arg): Handle UB.

    gcc/testsuite/ChangeLog:
            * gcc.dg/pr97986-1.c: New test.
            * gcc.dg/pr97986-2.c: New test.

Reply via email to