diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2009-03-27 22:33:16 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2009-03-27 15:33:16 -0700 |
commit | d9223014f991d207719b03fca8d8433edc58f27a (patch) | |
tree | 730765d79cb3b96fe1aa99617f3d96390ff336d7 /gcc | |
parent | 689b689c17aa25f3ba3e1390a5bf513bd586c46a (diff) | |
download | gcc-d9223014f991d207719b03fca8d8433edc58f27a.zip gcc-d9223014f991d207719b03fca8d8433edc58f27a.tar.gz gcc-d9223014f991d207719b03fca8d8433edc58f27a.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 2 | ||||
-rw-r--r-- | gcc/c-common.c | 8 | ||||
-rw-r--r-- | gcc/emit-rtl.c | 2 | ||||
-rw-r--r-- | gcc/expr.h | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr39323-1.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr39323-2.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr39323-3.c | 7 | ||||
-rw-r--r-- | gcc/tree.h | 6 |
11 files changed, 56 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 408250b..9ea8830 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,18 @@ 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 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8752b3b..97bd260 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +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 diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 7b52d90..8c5dc58 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -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); diff --git a/gcc/c-common.c b/gcc/c-common.c index 820d859..9b066f4 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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; } diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index ca03382..1f51e12 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0060483..269c540 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,12 @@ 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. diff --git a/gcc/testsuite/gcc.dg/pr39323-1.c b/gcc/testsuite/gcc.dg/pr39323-1.c new file mode 100644 index 0000000..2876bf3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr39323-1.c @@ -0,0 +1,5 @@ +/* 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" } */ diff --git a/gcc/testsuite/gcc.dg/pr39323-2.c b/gcc/testsuite/gcc.dg/pr39323-2.c new file mode 100644 index 0000000..2eaa6e9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr39323-2.c @@ -0,0 +1,6 @@ +/* PR c/39323 */ +/* { dg-do compile { target *-*-linux* } } */ + +int bar __attribute__ ((aligned(1 << 28))) = 20; + +/* { dg-final { scan-assembler "\.align\[\\t \]*268435456" } } */ diff --git a/gcc/testsuite/gcc.dg/pr39323-3.c b/gcc/testsuite/gcc.dg/pr39323-3.c new file mode 100644 index 0000000..cbfed9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr39323-3.c @@ -0,0 +1,7 @@ +/* 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; |