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

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

https://gcc.gnu.org/g:962723b046ae6406c0c457bfdb76318b3652673f

commit r17-4908-g962723b046ae6406c0c457bfdb76318b3652673f
Author: Dominic P <[email protected]>
Date:   Fri Oct 2 19:10:50 2026 +0100

    c: Do not keep excess precision for the result of ! [PR123370]

    build_unary_op strips an EXCESS_PRECISION_EXPR from its operand and wraps
    the result in one again, but the result of ! is int.  So with _Float16
    (or float with x87 excess precision), !(x - y) kept the type of x - y:
    sizeof and _Generic saw _Float16, ?: ICEd in build_conditional_expr,
    and !(x - y) / 2 ICEd at expand.  Do not re-wrap the result of
    TRUTH_NOT_EXPR; the operand is still tested at its excess precision, as
    for (x - y) == 0.

    Bootstrapped and regression tested on x86_64-pc-linux-gnu.  On
    aarch64-linux-gnu (qemu, SVE VL128), regression tested dg.exp,
    aarch64.exp and the SVE tests; the SVE tests also at VL2048.  Tested
    together with the two PR121105 patches and an earlier version of the
    tests; the final gcc.dg/pr123370.c was compiled and run on
    aarch64-linux-gnu (qemu), gcc.target/i386/pr123370.c run on
    x86_64-pc-linux-gnu with -m32.

    Assisted-by: Claude Opus 5 (Anthropic)

            PR c/123370

    gcc/c/ChangeLog:

            * c-typeck.cc (build_unary_op) <case TRUTH_NOT_EXPR>: Clear eptype.

    gcc/testsuite/ChangeLog:

            * gcc.dg/pr123370.c: New test.
            * gcc.target/i386/pr123370.c: New test.

    Signed-off-by: Dominic P <[email protected]>

Reply via email to