aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/config
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-10-25 14:09:42 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2024-10-25 14:50:24 +0200
commit7965062f9e9ba634247b1dab22e1d83f446337ab (patch)
treebc990de11a719de861ecada5e8876a64e63bec0e /libstdc++-v3/config
parent8bd4f104ff9cd4d47b301698ae29010924a0fe9d (diff)
downloadgcc-releases/gcc-14.zip
gcc-releases/gcc-14.tar.gz
gcc-releases/gcc-14.tar.bz2
Assorted --disable-checking fixes [PR117249]releases/gcc-14
We have currently 3 different definitions of gcc_assert macro, one used most of the time (unless --disable-checking) which evaluates the condition at runtime and also checks it at runtime, then one for --disable-checking GCC 4.5+ which looks like ((void)(UNLIKELY (!(EXPR)) ? __builtin_unreachable (), 0 : 0)) and a fallback one ((void)(0 && (EXPR))) Now, the last one actually doesn't evaluate any of the side-effects in the argument, just quiets up unused var/parameter warnings. I've tried to replace the middle definition with ({ [[assume (EXPR)]]; (void) 0; }) for compilers which support assume attribute and statement expressions (surprisingly quite a few spots use gcc_assert inside of comma expressions), but ran into PR117287, so for now such a change isn't being proposed. The following patch attempts to move important side-effects from gcc_assert arguments. Bootstrapped/regtested on x86_64-linux and i686-linux with normal --enable-checking=yes,rtl,extra, plus additionally I've attempted to do x86_64-linux bootstrap with --disable-checking and gcc_assert changed to the ((void)(0 && (EXPR))) version when --disable-checking. That version ran into spurious middle-end warnings ../../gcc/../include/libiberty.h:733:36: error: argument to ‘alloca’ is too large [-Werror=alloca-larger-than=] ../../gcc/tree-ssa-reassoc.cc:5659:20: note: in expansion of macro ‘XALLOCAVEC’ int op_num = ops.length (); int op_normal_num = op_num; gcc_assert (op_num > 0); int stmt_num = op_num - 1; gimple **stmts = XALLOCAVEC (gimple *, stmt_num); where we have gcc_assert exactly to work-around middle-end warnings. Guess I'd need to also disable -Werror for this experiment, which actually isn't a problem with unmodified system.h, because even for --disable-checking we use the __builtin_unreachable at least in stage2/stage3 and so the warnings aren't emitted, and even if it used [[assume ()]]; it would work too because in stage2/stage3 we could again rely on assume and statement expression support. 2024-10-25 Jakub Jelinek <jakub@redhat.com> PR middle-end/117249 * tree-ssa-structalias.cc (insert_vi_for_tree): Move put calls out of gcc_assert. * lto-cgraph.cc (lto_symtab_encoder_delete_node): Likewise. * gimple-ssa-strength-reduction.cc (get_alternative_base, add_cand_for_stmt): Likewise. * tree-eh.cc (add_stmt_to_eh_lp_fn): Likewise. * except.cc (duplicate_eh_regions_1): Likewise. * tree-ssa-reassoc.cc (insert_operand_rank): Likewise. * config/nvptx/nvptx.cc (nvptx_expand_call): Use == rather than = in gcc_assert. * opts-common.cc (jobserver_info::disconnect): Call close outside of gcc_assert and only check result in it. (jobserver_info::return_token): Call write outside of gcc_assert and only check result in it. * genautomata.cc (output_default_latencies): Move j++ side-effect outside of gcc_assert. * tree-ssa-loop-ivopts.cc (get_alias_ptr_type_for_ptr_address): Use == rather than = in gcc_assert. * cgraph.cc (symbol_table::create_edge): Move ++edges_max_uid side-effect outside of gcc_assert. (cherry picked from commit e2a8772c9328960c625f5b95091d4312efa0e284)
Diffstat (limited to 'libstdc++-v3/config')
0 files changed, 0 insertions, 0 deletions