Commit d9223014 by H.J. Lu Committed by H.J. Lu

re PR target/39323 (MAX_OFILE_ALIGNMENT in elfos.h is too big)

gcc/

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.

From-SVN: r145136
parent 689b689c
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
......@@ -1707,7 +1707,7 @@ create_field_decl (tree field_name, tree field_type, tree record_type,
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);
......
......@@ -5976,7 +5976,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
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;
......@@ -5998,7 +5998,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
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)
......@@ -6008,7 +6008,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
*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 "
......@@ -6021,7 +6021,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
}
else
{
DECL_ALIGN (decl) = (1 << i) * BITS_PER_UNIT;
DECL_ALIGN (decl) = (1U << i) * BITS_PER_UNIT;
DECL_USER_ALIGN (decl) = 1;
}
......
......@@ -1495,7 +1495,7 @@ mem_expr_equal_p (const_tree expr1, const_tree expr2)
-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;
......
......@@ -699,7 +699,7 @@ extern void set_mem_attributes_minus_bitpos (rtx, tree, int, HOST_WIDE_INT);
/* 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.
......
/* 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" } */
/* PR c/39323 */
/* { dg-do compile { target *-*-linux* } } */
int bar __attribute__ ((aligned(1 << 28))) = 20;
/* { dg-final { scan-assembler "\.align\[\\t \]*268435456" } } */
/* 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" } } */
......@@ -2726,10 +2726,9 @@ struct tree_decl_common GTY(())
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;
......@@ -2738,6 +2737,9 @@ struct tree_decl_common GTY(())
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment