diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2011-06-29 09:42:42 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2011-06-29 09:42:42 +0000 |
commit | 73f6eabc3ae4de22a83135f03f8c8688623661a1 (patch) | |
tree | 959a91c1ec3ac4f1dfeb6120dc9880fdef666220 /gcc | |
parent | 0e8377f2d813a56813022c8aad6b3ba7f3a3edbc (diff) | |
download | gcc-73f6eabc3ae4de22a83135f03f8c8688623661a1.zip gcc-73f6eabc3ae4de22a83135f03f8c8688623661a1.tar.gz gcc-73f6eabc3ae4de22a83135f03f8c8688623661a1.tar.bz2 |
re PR middle-end/49545 (New C++ test failures)
gcc/
PR tree-optimization/49545
* builtins.c (get_object_alignment_1): Update function comment.
Do not use DECL_ALIGN for functions, but test
TARGET_PTRMEMFUNC_VBIT_LOCATION instead.
* fold-const.c (get_pointer_modulus_and_residue): Don't check
for functions here.
* tree-ssa-ccp.c (get_value_from_alignment): Likewise.
gcc/testsuite/
* gcc.dg/torture/pr49169.c: Restrict to ARM and MIPS targets.
From-SVN: r175627
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/builtins.c | 27 | ||||
-rw-r--r-- | gcc/fold-const.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr49169.c | 2 | ||||
-rw-r--r-- | gcc/tree-ssa-ccp.c | 4 |
6 files changed, 41 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91c23f2..0a87e3c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2011-06-29 Richard Sandiford <richard.sandiford@linaro.org> + + PR tree-optimization/49545 + * builtins.c (get_object_alignment_1): Update function comment. + Do not use DECL_ALIGN for functions, but test + TARGET_PTRMEMFUNC_VBIT_LOCATION instead. + * fold-const.c (get_pointer_modulus_and_residue): Don't check + for functions here. + * tree-ssa-ccp.c (get_value_from_alignment): Likewise. + 2011-06-29 Jakub Jelinek <jakub@redhat.com> PR debug/49567 diff --git a/gcc/builtins.c b/gcc/builtins.c index 0747e04..1ee8cf8 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -264,8 +264,15 @@ called_as_built_in (tree node) return is_builtin_name (name); } -/* Return the alignment in bits of EXP, an object. - Don't return more than MAX_ALIGN no matter what. */ +/* Compute values M and N such that M divides (address of EXP - N) and + such that N < M. Store N in *BITPOSP and return M. + + Note that the address (and thus the alignment) computed here is based + on the address to which a symbol resolves, whereas DECL_ALIGN is based + on the address at which an object is actually located. These two + addresses are not always the same. For example, on ARM targets, + the address &foo of a Thumb function foo() has the lowest bit set, + whereas foo() itself starts on an even address. */ unsigned int get_object_alignment_1 (tree exp, unsigned HOST_WIDE_INT *bitposp) @@ -287,7 +294,21 @@ get_object_alignment_1 (tree exp, unsigned HOST_WIDE_INT *bitposp) exp = DECL_INITIAL (exp); if (DECL_P (exp) && TREE_CODE (exp) != LABEL_DECL) - align = DECL_ALIGN (exp); + { + if (TREE_CODE (exp) == FUNCTION_DECL) + { + /* Function addresses can encode extra information besides their + alignment. However, if TARGET_PTRMEMFUNC_VBIT_LOCATION + allows the low bit to be used as a virtual bit, we know + that the address itself must be 2-byte aligned. */ + if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn) + align = 2 * BITS_PER_UNIT; + else + align = BITS_PER_UNIT; + } + else + align = DECL_ALIGN (exp); + } else if (CONSTANT_CLASS_P (exp)) { align = TYPE_ALIGN (TREE_TYPE (exp)); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9428c11..e48aae9 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9216,8 +9216,7 @@ get_pointer_modulus_and_residue (tree expr, unsigned HOST_WIDE_INT *residue, *residue = 0; code = TREE_CODE (expr); - if (code == ADDR_EXPR - && TREE_CODE (TREE_OPERAND (expr, 0)) != FUNCTION_DECL) + if (code == ADDR_EXPR) { unsigned int bitalign; bitalign = get_object_alignment_1 (TREE_OPERAND (expr, 0), residue); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f0b9eb1..ee72747 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-06-29 Richard Sandiford <richard.sandiford@linaro.org> + + * gcc.dg/torture/pr49169.c: Restrict to ARM and MIPS targets. + 2011-06-29 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * gcc.dg/inline_1.c: Remove dg-excess-errors. diff --git a/gcc/testsuite/gcc.dg/torture/pr49169.c b/gcc/testsuite/gcc.dg/torture/pr49169.c index 721b2ac..c7800bb 100644 --- a/gcc/testsuite/gcc.dg/torture/pr49169.c +++ b/gcc/testsuite/gcc.dg/torture/pr49169.c @@ -1,3 +1,5 @@ +/* { dg-do compile { target { arm*-*-* || mips*-*-* } } } */ + #include <stdlib.h> #include <stdint.h> diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 78724de..94a09e0 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -520,10 +520,6 @@ get_value_from_alignment (tree expr) val = bit_value_binop (PLUS_EXPR, TREE_TYPE (expr), TREE_OPERAND (base, 0), TREE_OPERAND (base, 1)); else if (base - /* ??? While function decls have DECL_ALIGN their addresses - may encode extra information in the lower bits on some - targets (PR47239). Simply punt for function decls for now. */ - && TREE_CODE (base) != FUNCTION_DECL && ((align = get_object_alignment (base, BIGGEST_ALIGNMENT)) > BITS_PER_UNIT)) { |