diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-09-15 10:34:33 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-09-15 10:34:33 +0200 |
commit | bd83c6227c6c2ccb5df88937a338b501fd550de6 (patch) | |
tree | eb8cc0e235da85f101ed3b4debc8eff05c4b47ed /gcc/c-family | |
parent | 6485b105655c2179eb9f74ac35d535912f43cac5 (diff) | |
download | gcc-master.zip gcc-master.tar.gz gcc-master.tar.bz2 |
expr, tree: Ensure get_range_pos_neg is called only on scalar integral types [PR121904]HEADtrunkmaster
The gcc.c-torture/compile/20111209-1.c testcase which uses
typedef char* char_ptr32 __attribute__ ((mode(SI)));
ICEs on s390x since my change to optimize extensions by cheaper of
signed or unsigned extension if sign bit is known from VRP not to be set.
The problem is that get_range_pos_neg uses ranger into int_range_max
and so ICEs on pointers. All the other current callers call it from places
where only scalar integral types can appear (scalar division/modulo,
overflow ifns, etc.) I think, this spot was just testing SCALAR_INT_MODE_P.
The following patch adds check for INTEGRAL_TYPE_P, I think ranger will not
do anything useful for pointers here anyway and what is a negative pointer
is also fuzzy. I've changed both get_range_pos_neg to punt on that and
the caller, either of those changes are sufficient to fix the ICE, but I
think it doesn't hurt to do it in both places.
2025-09-15 Jakub Jelinek <jakub@redhat.com>
PR middle-end/121904
* tree.cc (get_range_pos_neg): Return 3 if arg doesn't have
scalar integral type.
* expr.cc (expand_expr_real_2) <CASE_CONVERT>: Only choose between
sign and zero extension based on costs for scalar integral inner
types.
Diffstat (limited to 'gcc/c-family')
0 files changed, 0 insertions, 0 deletions