aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2009-03-27 22:33:16 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2009-03-27 15:33:16 -0700
commitd9223014f991d207719b03fca8d8433edc58f27a (patch)
tree730765d79cb3b96fe1aa99617f3d96390ff336d7 /gcc/c-common.c
parent689b689c17aa25f3ba3e1390a5bf513bd586c46a (diff)
downloadgcc-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/c-common.c')
-rw-r--r--gcc/c-common.c8
1 files changed, 4 insertions, 4 deletions
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;
}