From: Richard Sandiford Date: Mon, 27 Jun 2011 09:33:06 +0000 (+0000) Subject: re PR rtl-optimization/49169 (ARM: optimisations strip the Thumb/ARM mode bit off... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=afc3f22f90ca9b2e1028949e671acf78dcb2b4b3;p=gcc.git re PR rtl-optimization/49169 (ARM: optimisations strip the Thumb/ARM mode bit off function pointers) gcc/ 2011-07-24 Richard Guenther PR tree-optimization/49169 * fold-const.c (get_pointer_modulus_and_residue): Don't rely on the alignment of function decls. gcc/testsuite/ 2011-07-24 Michael Hope Richard Sandiford PR tree-optimization/49169 * gcc.dg/torture/pr49169.c: New test. From-SVN: r175427 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 76025dfeddc..e9dae06a29c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-06-27 Richard Guenther + + PR tree-optimization/49169 + * fold-const.c (get_pointer_modulus_and_residue): Don't rely on + the alignment of function decls. + 2011-06-26 Iain Sandoe PR target/47997 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e48aae9f4ce..9428c11e4ac 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -9216,7 +9216,8 @@ get_pointer_modulus_and_residue (tree expr, unsigned HOST_WIDE_INT *residue, *residue = 0; code = TREE_CODE (expr); - if (code == ADDR_EXPR) + if (code == ADDR_EXPR + && TREE_CODE (TREE_OPERAND (expr, 0)) != FUNCTION_DECL) { unsigned int bitalign; bitalign = get_object_alignment_1 (TREE_OPERAND (expr, 0), residue); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8c8e1b3dc79..c833b41a620 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-06-27 Michael Hope + Richard Sandiford + + PR tree-optimization/49169 + * gcc.dg/torture/pr49169.c: New test. + 2011-06-26 John David Anglin PR testsuite/49529 diff --git a/gcc/testsuite/gcc.dg/torture/pr49169.c b/gcc/testsuite/gcc.dg/torture/pr49169.c new file mode 100644 index 00000000000..721b2ac6435 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr49169.c @@ -0,0 +1,13 @@ +#include +#include + +int +main (void) +{ + void *p = main; + if ((intptr_t) p & 1) + abort (); + return 0; +} + +/* { dg-final { scan-assembler "abort" } } */