2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
PR c/39323
* c-common.c (handle_aligned_attribute): Properly check alignment
overflow. Use (1U << i) instead of (1 << i).
* emit-rtl.c (get_mem_align_offset): Use "unsigned int" for
align.
* expr.h (get_mem_align_offset): Updated.
* tree.h (tree_decl_common): Change align to "unsigned int" and
move it before pointer_alias_set.
gcc/ada/
2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
PR c/39323
* gcc-interface/utils.c (create_field_decl): Use "unsigned int"
on bit_align.
gcc/testsuite/
2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
PR c/39323
* gcc.dg/pr39323-1.c: New.
* gcc.dg/pr39323-2.c: Likewise.
* gcc.dg/pr39323-3.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145136
138bc75d-0d04-0410-961f-
82ee72b054a4
2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c/39323
+ * c-common.c (handle_aligned_attribute): Properly check alignment
+ overflow. Use (1U << i) instead of (1 << i).
+
+ * emit-rtl.c (get_mem_align_offset): Use "unsigned int" for
+ align.
+
+ * expr.h (get_mem_align_offset): Updated.
+
+ * tree.h (tree_decl_common): Change align to "unsigned int" and
+ move it before pointer_alias_set.
+
+2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
Jakub Jelinek <jakub@redhat.com>
PR target/38034
+2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR c/39323
+ * gcc-interface/utils.c (create_field_decl): Use "unsigned int"
+ on bit_align.
+
2009-03-11 Olivier Hainque <hainque@adacore.com>
* gcc-interface/trans.c (gnat_to_gnu) <case N_Slice>: In range
we get the alignment from the type, indicate if this is from an explicit
user request, which prevents stor-layout from lowering it later on. */
{
- int bit_align
+ unsigned int bit_align
= (DECL_BIT_FIELD (field_decl) ? 1
: packed && TYPE_MODE (field_type) != BLKmode ? BITS_PER_UNIT : 0);
error ("requested alignment is not a power of 2");
*no_add_attrs = true;
}
- else if (i > HOST_BITS_PER_INT - 2)
+ else if (i >= HOST_BITS_PER_INT - BITS_PER_UNIT_LOG)
{
error ("requested alignment is too large");
*no_add_attrs = true;
else if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*type = build_variant_type_copy (*type);
- TYPE_ALIGN (*type) = (1 << i) * BITS_PER_UNIT;
+ TYPE_ALIGN (*type) = (1U << i) * BITS_PER_UNIT;
TYPE_USER_ALIGN (*type) = 1;
}
else if (! VAR_OR_FUNCTION_DECL_P (decl)
*no_add_attrs = true;
}
else if (TREE_CODE (decl) == FUNCTION_DECL
- && DECL_ALIGN (decl) > (1 << i) * BITS_PER_UNIT)
+ && DECL_ALIGN (decl) > (1U << i) * BITS_PER_UNIT)
{
if (DECL_USER_ALIGN (decl))
error ("alignment for %q+D was previously specified as %d "
}
else
{
- DECL_ALIGN (decl) = (1 << i) * BITS_PER_UNIT;
+ DECL_ALIGN (decl) = (1U << i) * BITS_PER_UNIT;
DECL_USER_ALIGN (decl) = 1;
}
-1 if not known. */
int
-get_mem_align_offset (rtx mem, int align)
+get_mem_align_offset (rtx mem, unsigned int align)
{
tree expr;
unsigned HOST_WIDE_INT offset;
/* Return OFFSET if XEXP (MEM, 0) - OFFSET is known to be ALIGN
bits aligned for 0 <= OFFSET < ALIGN / BITS_PER_UNIT, or
-1 if not known. */
-extern int get_mem_align_offset (rtx, int);
+extern int get_mem_align_offset (rtx, unsigned int);
/* Assemble the static constant template for function entry trampolines. */
extern rtx assemble_trampoline_template (void);
2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
+ PR c/39323
+ * gcc.dg/pr39323-1.c: New.
+ * gcc.dg/pr39323-2.c: Likewise.
+ * gcc.dg/pr39323-3.c: Likewise.
+
+2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
+
PR target/38034
* gcc.target/ia64/sync-1.c: New.
--- /dev/null
+/* PR c/39323 */
+/* { dg-do compile { target *-*-linux* } } */
+
+int foo __attribute__ ((aligned(1 << 29))) = 20; /* { dg-error "requested alignment is too large" } */
+typedef int __attribute__ ((aligned(1 << 29))) int29; /* { dg-error "requested alignment is too large" } */
--- /dev/null
+/* PR c/39323 */
+/* { dg-do compile { target *-*-linux* } } */
+
+int bar __attribute__ ((aligned(1 << 28))) = 20;
+
+/* { dg-final { scan-assembler "\.align\[\\t \]*268435456" } } */
--- /dev/null
+/* PR c/39323 */
+/* { dg-do compile { target *-*-linux* } } */
+
+typedef int __attribute__ ((aligned(1 << 28))) int28;
+int28 foo = 20;
+
+/* { dg-final { scan-assembler "\.align\[\\t \]*268435456" } } */
unsigned gimple_reg_flag : 1;
/* In a DECL with pointer type, set if no TBAA should be done. */
unsigned no_tbaa_flag : 1;
- /* Padding so that 'align' can be on a 32-bit boundary. */
+ /* Padding so that 'off_align' can be on a 32-bit boundary. */
unsigned decl_common_unused : 2;
- unsigned int align : 24;
/* DECL_OFFSET_ALIGN, used only for FIELD_DECLs. */
unsigned int off_align : 8;
tree attributes;
tree abstract_origin;
+ /* DECL_ALIGN. It should have the same size as TYPE_ALIGN. */
+ unsigned int align;
+
alias_set_type pointer_alias_set;
/* Points to a structure whose details depend on the language in use. */
struct lang_decl *lang_specific;