aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-11-23 12:59:54 +0100
committerJakub Jelinek <jakub@redhat.com>2023-11-23 12:59:54 +0100
commitf9982ef4f55bd3a63745e03ac6d68b4a92fa8bce (patch)
treed79e2b030cbe130d2fcacfb75ceb784755338eca /gcc/expr.cc
parent97ddebb6b4f6b132b0a8072b26d030077b418963 (diff)
downloadgcc-f9982ef4f55bd3a63745e03ac6d68b4a92fa8bce.zip
gcc-f9982ef4f55bd3a63745e03ac6d68b4a92fa8bce.tar.gz
gcc-f9982ef4f55bd3a63745e03ac6d68b4a92fa8bce.tar.bz2
expr: Fix &bitint_var handling in initializers [PR112336]
As the following testcase shows, we ICE when trying to emit ADDR_EXPR of a bitint variable which doesn't have mode width. The problem is in the EXTEND_BITINT stuff which makes sure we treat the padding bits on memory reads from user bitint vars as undefined. When expanding ADDR_EXPR on such vars inside outside of initializers, expand_expr_addr* uses EXPAND_CONST_ADDRESS modifier and EXTEND_BITINT does nothing, but in initializers it keeps using EXPAND_INITIALIZER modifier. So, we need to treat EXPAND_INITIALIZER the same as EXPAND_CONST_ADDRESS for this regard. 2023-11-23 Jakub Jelinek <jakub@redhat.com> PR middle-end/112336 * expr.cc (EXTEND_BITINT): Don't call reduce_to_bit_field_precision if modifier is EXPAND_INITIALIZER. * gcc.dg/bitint-41.c: New test.
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r--gcc/expr.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 556bcf7..d932067 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -10698,6 +10698,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
&& mode != BLKmode \
&& modifier != EXPAND_MEMORY \
&& modifier != EXPAND_WRITE \
+ && modifier != EXPAND_INITIALIZER \
&& modifier != EXPAND_CONST_ADDRESS) \
? reduce_to_bit_field_precision ((expr), NULL_RTX, type) : (expr))