aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-02-21 17:22:51 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-03-09 22:17:01 +0100
commitd1239bab5bc931f14f4dc7c4c55aa66f34cc79b1 (patch)
treec3a2a27734173889ef08d4fb0e013c55a861e11b
parente528e0755d46344f07e44bfbb3f90477747925cf (diff)
downloadsparse-d1239bab5bc931f14f4dc7c4c55aa66f34cc79b1.tar.gz
ssa: avoid SSA conversion of packed bitfields
Packed bitfields are incompatible with the SSA conversion which works on the assumption that memory operations are done on the whole symbol. So, directly exclude packed bitfields from the SSA conversion. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--ssa.c3
-rw-r--r--validation/mem2reg/packed-bitfield.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/ssa.c b/ssa.c
index 3f4fa1a8..26d46baa 100644
--- a/ssa.c
+++ b/ssa.c
@@ -32,6 +32,9 @@ static inline bool is_promotable(struct symbol *type)
case SYM_STRUCT:
// we allow a single scalar field
// but a run of bitfields count for 1
+ // (and packed bifields are excluded).
+ if (type->packed)
+ return 0;
nbr = 0;
bf_seen = 0;
FOR_EACH_PTR(type->symbol_list, member) {
diff --git a/validation/mem2reg/packed-bitfield.c b/validation/mem2reg/packed-bitfield.c
index 4eaf0bef..f3ee259a 100644
--- a/validation/mem2reg/packed-bitfield.c
+++ b/validation/mem2reg/packed-bitfield.c
@@ -12,7 +12,6 @@ static void foo(struct s s)
/*
* check-name: packed-bitfield
* check-command: test-linearize -fmem2reg $file
- * check-known-to-fail
*
* check-output-contains: store.32
* check-output-contains: load.16