Richard,
in gimplify_vla_decl, the alloca argument seems to be the size of the vla in
units:
...
t = build_call_expr (t, 1, DECL_SIZE_UNIT (decl));
...
I wonder why we are going through this 8 vs. BITS_PER_UNIT conversion here:
...
elem_type = build_nonstandard_integer_type (BITS_PER_UNIT, 1);
n_elem = size * 8 / BITS_PER_UNIT;
align = MIN (size * 8, BIGGEST_ALIGNMENT);
...
The element size is BITS_PER_UNIT, so 1 unit, and size is in units.
Shouldn't this be:
...
Index: tree-ssa-ccp.c
===================================================================
--- tree-ssa-ccp.c (revision 179210)
+++ tree-ssa-ccp.c (working copy)
@@ -1722,8 +1722,8 @@ fold_builtin_alloca_for_var (gimple stmt
/* Declare array. */
elem_type = build_nonstandard_integer_type (BITS_PER_UNIT, 1);
- n_elem = size * 8 / BITS_PER_UNIT;
- align = MIN (size * 8, BIGGEST_ALIGNMENT);
+ n_elem = size;
+ align = MIN (size * BITS_PER_UNIT, BIGGEST_ALIGNMENT);
if (align < BITS_PER_UNIT)
align = BITS_PER_UNIT;
array_type = build_array_type_nelts (elem_type, n_elem);
...
Thanks,
- Tom