From: Andrew Pinski Date: Mon, 20 Apr 2026 05:05:33 +0000 (-0700) Subject: c++: Handle EXACT_DIV_EXPR as printing `/` [PR119567] X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b183634956ae52ceafca5c32f70bb60ebbf7e34c;p=thirdparty%2Fgcc.git c++: Handle EXACT_DIV_EXPR as printing `/` [PR119567] Before r8-4233-g6ff16d19d26a41, we would print EXACT_DIV_EXPR as `(ceiling /)` which is wrong. Now we print it as `unknown operator` which is also wrong. Printing it as `/` is correct here since it is the similar to `FLOOR_DIV_EXPR` except it is undefined behavior if it is not exact (so floor is fine :)). This shows up when printing out the reason why the following is not a contexpr: constexpr int (*p1)[0] = 0, (*p2)[0] = 0; constexpr int k2 = p2 - p1; Bootstrapped and tested on x86_64-linux-gnu. PR c++/119567 gcc/cp/ChangeLog: * error.cc (dump_expr): Treat EXACT_DIV_EXPR the same as FLOOR_DIV_EXPR. Signed-off-by: Andrew Pinski --- diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 2ea9d1a7bcd..5f4cb477230 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -2629,7 +2629,6 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) case EQ_EXPR: case NE_EXPR: case SPACESHIP_EXPR: - case EXACT_DIV_EXPR: dump_binary_op (pp, OVL_OP_INFO (false, TREE_CODE (t))->name, t, flags); break; @@ -2637,6 +2636,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) case FLOOR_DIV_EXPR: case ROUND_DIV_EXPR: case RDIV_EXPR: + case EXACT_DIV_EXPR: dump_binary_op (pp, "/", t, flags); break;