diff options
Diffstat (limited to 'gcc/sanopt.c')
-rw-r--r-- | gcc/sanopt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/sanopt.c b/gcc/sanopt.c index 997bcfd..d726c5e 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -459,7 +459,7 @@ record_ubsan_ptr_check_stmt (sanopt_ctx *ctx, gimple *stmt, tree ptr, static bool maybe_optimize_ubsan_ptr_ifn (sanopt_ctx *ctx, gimple *stmt) { - HOST_WIDE_INT bitsize, bitpos; + poly_int64 bitsize, pbitpos; machine_mode mode; int volatilep = 0, reversep, unsignedp = 0; tree offset; @@ -483,9 +483,12 @@ maybe_optimize_ubsan_ptr_ifn (sanopt_ctx *ctx, gimple *stmt) { base = TREE_OPERAND (base, 0); - base = get_inner_reference (base, &bitsize, &bitpos, &offset, &mode, + HOST_WIDE_INT bitpos; + base = get_inner_reference (base, &bitsize, &pbitpos, &offset, &mode, &unsignedp, &reversep, &volatilep); - if (offset == NULL_TREE && DECL_P (base)) + if (offset == NULL_TREE + && DECL_P (base) + && pbitpos.is_constant (&bitpos)) { gcc_assert (!DECL_REGISTER (base)); offset_int expr_offset = bitpos / BITS_PER_UNIT; |