This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR42559
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 1 Jan 2010 14:53:19 +0100 (CET)
- Subject: [PATCH] Fix PR42559
This adjusts get_object_alignment to properly deal with
LABEL_DECLs.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2010-01-01 Richard Guenther <rguenther@suse.de>
PR middle-end/42559
* builtins.c (get_object_alignment): Do not use DECL_ALIGN
for LABEL_DECLs.
* gcc.c-torture/compile/pr42559.c: New testcase.
Index: gcc/builtins.c
===================================================================
*** gcc/builtins.c (revision 155535)
--- gcc/builtins.c (working copy)
*************** get_object_alignment (tree exp, unsigned
*** 325,331 ****
}
if (TREE_CODE (exp) == CONST_DECL)
exp = DECL_INITIAL (exp);
! if (DECL_P (exp))
align = MIN (inner, DECL_ALIGN (exp));
#ifdef CONSTANT_ALIGNMENT
else if (CONSTANT_CLASS_P (exp))
--- 325,332 ----
}
if (TREE_CODE (exp) == CONST_DECL)
exp = DECL_INITIAL (exp);
! if (DECL_P (exp)
! && TREE_CODE (exp) != LABEL_DECL)
align = MIN (inner, DECL_ALIGN (exp));
#ifdef CONSTANT_ALIGNMENT
else if (CONSTANT_CLASS_P (exp))
Index: gcc/testsuite/gcc.c-torture/compile/pr42559.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/pr42559.c (revision 0)
--- gcc/testsuite/gcc.c-torture/compile/pr42559.c (revision 0)
***************
*** 0 ****
--- 1,8 ----
+ void jumpfunc(int copy, void *p)
+ {
+ void *l = &&jumplabel;
+ if (copy)
+ __builtin___memcpy_chk (p, l, 128, __builtin_object_size (p, 0));
+ jumplabel:
+ return;
+ }