- if (count < max_count
+ /* The pool is aligned to a 4-byte boundary. However, 16-bit Thumb
+ insns can result in count being unaligned here, so we must compare
+ the aligned offset against the limit. */
+ if (((count + 3) & ~3) < max_count
&& (!selected || new_cost <= selected_cost))
{
selected = from;
This patch against trunk fixes it:
diff --git a/gcc/config/ arm/arm. c b/gcc/config/ arm/arm. c arm/arm. c arm/arm. c
index 866385c..18d0ff4 100644
--- a/gcc/config/
+++ b/gcc/config/
@@ -13021,7 +13021,10 @@ create_fix_barrier (Mfix *fix, HOST_WIDE_INT max_address)
new_cost = arm_barrier_cost (from);
- if (count < max_count
+ /* The pool is aligned to a 4-byte boundary. However, 16-bit Thumb
+ insns can result in count being unaligned here, so we must compare
+ the aligned offset against the limit. */
+ if (((count + 3) & ~3) < max_count
&& (!selected || new_cost <= selected_cost))
{
selected = from;