aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-04-16 14:05:35 +0200
committerRichard Biener <rguenther@suse.de>2024-04-30 13:03:55 +0200
commit667c19de86b33648f5f4599f589a5e02adbb35cb (patch)
tree8c72a06586c5519ce16016130a25793b0a77cf9f /gcc/c
parent6c6b70f07208ca14ba783933988c04c6fc2fff42 (diff)
downloadgcc-667c19de86b33648f5f4599f589a5e02adbb35cb.zip
gcc-667c19de86b33648f5f4599f589a5e02adbb35cb.tar.gz
gcc-667c19de86b33648f5f4599f589a5e02adbb35cb.tar.bz2
middle-end/13421 - -ftrapv vs. POINTER_DIFF_EXPR
Currently we expand POINTER_DIFF_EXPR using subv_optab when -ftrapv (but -fsanitize=undefined does nothing). That's not consistent with the behavior of POINTER_PLUS_EXPR which never uses addv_optab with -ftrapv. Both are because of the way we select whether to use the trapping or the non-trapping optab - we look at the result type of the expression and check trapv = INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type); the bugreport correctly complains that -ftrapv affects pointer subtraction (there's no -ftrapv-pointer). Now that we have POINTER_DIFF_EXPR we can honor that appropriately. The patch moves both POINTER_DIFF_EXPR and POINTER_PLUS_EXPR handling so they will never consider trapping (or saturating) optabs. PR middle-end/13421 * optabs-tree.cc (optab_for_tree_code): Do not consider {add,sub}v or {us,ss}{add,sub} optabs for POINTER_DIFF_EXPR or POINTER_PLUS_EXPR.
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions