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

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

https://gcc.gnu.org/g:d172a9666d4281355786062dcc958a64e28a292c

commit r17-1480-gd172a9666d4281355786062dcc958a64e28a292c
Author: Jakub Jelinek <[email protected]>
Date:   Wed Jun 10 22:44:22 2026 +0200

    c, c++: Fix __builtin_{bswap,bitreverse}g error recovery [PR125694]

    The following invalid testcases ICE in both the C and C++ FEs.
    If arg is error_mark_node, TREE_TYPE works on it (and gives
error_mark_node)
    but TYPE_MAIN_VARIANT on it is already invalid.

    The following patch fixes it in both spot by checking for error_operand_p
    before that.

    2026-06-10  Jakub Jelinek  <[email protected]>

            PR c/125694
            * c-parser.cc (c_parser_postfix_expression): If arg is
            error_operand_p, set error and break.

            * typeck.cc (build_x_bswapg_bitreverseg ): If arg is
error_operand_p,
            return error_mark_node.

            * c-c++-common/builtin-bswapg-5.c: New test.
            * c-c++-common/builtin-bitreverseg-4.c: New test.

    Reviewed-by: Joseph Myers <[email protected]>
    Reviewed-by: Jason Merrill <[email protected]>

Reply via email to