From: Jakub Jelinek Date: Tue, 26 Mar 2024 09:03:27 +0000 (+0100) Subject: c-family, c++: Handle EXCESS_PRECISION_EXPR in pretty printers [PR112724] X-Git-Tag: basepoints/gcc-15~476 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10accfde57951db9f726e996f1b0be165df00f5c;p=thirdparty%2Fgcc.git c-family, c++: Handle EXCESS_PRECISION_EXPR in pretty printers [PR112724] I've noticed that the c-c++-common/gomp/depobj-3.c test FAILs on i686-linux: PASS: c-c++-common/gomp/depobj-3.c -std=c++17 at line 17 (test for warnings, line 15) FAIL: c-c++-common/gomp/depobj-3.c -std=c++17 at line 39 (test for warnings, line 37) PASS: c-c++-common/gomp/depobj-3.c -std=c++17 at line 43 (test for errors, line 41) PASS: c-c++-common/gomp/depobj-3.c -std=c++17 (test for warnings, line 45) FAIL: c-c++-common/gomp/depobj-3.c -std=c++17 (test for excess errors) Excess errors: /home/jakub/src/gcc/gcc/testsuite/c-c++-common/gomp/depobj-3.c:37:38: warning: the 'destroy' expression ''excess_precision_expr' not supported by dump_expr' should +be the same as the 'depobj' argument 'obj' [-Wopenmp] The following patch replaces that 'excess_precision_expr' not supported by dump_expr with (float)(((long double)a) + (long double)5) Still ugly and doesn't actually fix the FAIL (will deal with that incrementally), but at least valid C/C++ and shows the excess precision handling in action. 2024-03-26 Jakub Jelinek PR c++/112724 gcc/c-family/ * c-pretty-print.cc (pp_c_cast_expression, c_pretty_printer::expression): Handle EXCESS_PRECISION_EXPR like NOP_EXPR. gcc/cp/ * error.cc (dump_expr): Handle EXCESS_PRECISION_EXPR like NOP_EXPR. --- diff --git a/gcc/c-family/c-pretty-print.cc b/gcc/c-family/c-pretty-print.cc index 45045fb2242f..da7934d783a5 100644 --- a/gcc/c-family/c-pretty-print.cc +++ b/gcc/c-family/c-pretty-print.cc @@ -2327,6 +2327,7 @@ pp_c_cast_expression (c_pretty_printer *pp, tree e) case FIX_TRUNC_EXPR: CASE_CONVERT: case VIEW_CONVERT_EXPR: + case EXCESS_PRECISION_EXPR: if (!location_wrapper_p (e)) pp_c_type_cast (pp, TREE_TYPE (e)); pp_c_cast_expression (pp, TREE_OPERAND (e, 0)); @@ -2753,6 +2754,7 @@ c_pretty_printer::expression (tree e) case FIX_TRUNC_EXPR: CASE_CONVERT: case VIEW_CONVERT_EXPR: + case EXCESS_PRECISION_EXPR: pp_c_cast_expression (this, e); break; diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index d3fcac70ea17..7074845154e3 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -2662,6 +2662,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags) CASE_CONVERT: case IMPLICIT_CONV_EXPR: case VIEW_CONVERT_EXPR: + case EXCESS_PRECISION_EXPR: { tree op = TREE_OPERAND (t, 0);