Hi,
the new test gnat.dg/pack19.adb doesn't pass on some platforms because of the
target-dependent result of loads from bit-fields with size 0.
Unlike the stores to these bit-fields which are handled in an uniform way in
store_field:
/* If we have nothing to store, do nothing unless the expression has
side-effects. */
if (bitsize == 0)
return expand_expr (exp, const0_rtx, VOIDmode, EXPAND_NORMAL);
the result of the loads depends on SHIFT_COUNT_TRUNCATED: the result is 0 if
the macro is 0, otherwise it's garbage. The attached patch makes it so that
the result is always 0 independently of the target.
Tested on x86/Linux and PowerPC/Linux, OK for the mainline?
2013-12-09 Eric Botcazou <ebotca...@adacore.com>
* expr.c (expand_expr_real_1) <normal_inner_ref>: Always return 0 for
the extraction of a bit-field of null size.
--
Eric Botcazou
Index: expr.c
===================================================================
--- expr.c (revision 205774)
+++ expr.c (working copy)
@@ -10177,6 +10177,12 @@ expand_expr_real_1 (tree exp, rtx target
return target;
}
+ /* If we have nothing to extract, the result will be 0 for targets
+ with SHIFT_COUNT_TRUNCATED == 0 and garbage otherwise. Always
+ return 0 for the sake of consistency. */
+ if (bitsize == 0)
+ return const0_rtx;
+
op0 = validize_mem (op0);
if (MEM_P (op0) && REG_P (XEXP (op0, 0)))