From be5575b27f0fe085a6ac3534ae58df84c43d693c Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 3 Nov 2010 09:57:13 +0000 Subject: [PATCH] 2010-11-03 Richard Guenther PR middle-end/46251 * builtins.c (expand_builtin_sincos): Properly build MEM_REFs, not INDIRECT_REFs. * gcc.dg/pr46251.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166235 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/builtins.c | 9 +++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr46251.c | 7 +++++++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr46251.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b092477b9c8..6d4d1b5a96c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-11-03 Richard Guenther + + PR middle-end/46251 + * builtins.c (expand_builtin_sincos): Properly build MEM_REFs, + not INDIRECT_REFs. + 2010-11-03 Jakub Jelinek PR tree-optimization/46107 diff --git a/gcc/builtins.c b/gcc/builtins.c index 4ff0546c6d4..31a869bf1f6 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2474,6 +2474,7 @@ expand_builtin_sincos (tree exp) tree arg, sinp, cosp; int result; location_t loc = EXPR_LOCATION (exp); + tree alias_type, alias_off; if (!validate_arglist (exp, REAL_TYPE, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) @@ -2494,8 +2495,12 @@ expand_builtin_sincos (tree exp) target2 = gen_reg_rtx (mode); op0 = expand_normal (arg); - op1 = expand_normal (build_fold_indirect_ref_loc (loc, sinp)); - op2 = expand_normal (build_fold_indirect_ref_loc (loc, cosp)); + alias_type = build_pointer_type_for_mode (TREE_TYPE (arg), ptr_mode, true); + alias_off = build_int_cst (alias_type, 0); + op1 = expand_normal (fold_build2_loc (loc, MEM_REF, TREE_TYPE (arg), + sinp, alias_off)); + op2 = expand_normal (fold_build2_loc (loc, MEM_REF, TREE_TYPE (arg), + cosp, alias_off)); /* Compute into target1 and target2. Set TARGET to wherever the result comes back. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7af642f4932..184ebdb8879 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-11-03 Richard Guenther + + PR middle-end/46251 + * gcc.dg/pr46251.c: New testcase. + 2010-11-03 Jakub Jelinek PR tree-optimization/46107 diff --git a/gcc/testsuite/gcc.dg/pr46251.c b/gcc/testsuite/gcc.dg/pr46251.c new file mode 100644 index 00000000000..0eeb29fda9d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr46251.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-ffast-math" } */ + +void foo (long double *x) +{ + __builtin_sincosl (*x, x, x); +} -- 2.11.4.GIT