This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR46251


Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2010-11-02  Richard Guenther  <rguenther@suse.de>

	PR middle-end/46251
	* builtins.c (expand_builtin_sincos): Properly build MEM_REFs,
	not INDIRECT_REFs.

	* gcc.dg/pr46251.c: New testcase.

Index: gcc/builtins.c
===================================================================
*** gcc/builtins.c	(revision 166195)
--- gcc/builtins.c	(working copy)
*************** expand_builtin_sincos (tree exp)
*** 2474,2479 ****
--- 2474,2480 ----
    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))
*************** expand_builtin_sincos (tree exp)
*** 2494,2501 ****
    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));
  
    /* Compute into target1 and target2.
       Set TARGET to wherever the result comes back.  */
--- 2495,2506 ----
    target2 = gen_reg_rtx (mode);
  
    op0 = expand_normal (arg);
!   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.  */
Index: gcc/testsuite/gcc.dg/pr46251.c
===================================================================
*** gcc/testsuite/gcc.dg/pr46251.c	(revision 0)
--- gcc/testsuite/gcc.dg/pr46251.c	(revision 0)
***************
*** 0 ****
--- 1,7 ----
+ /* { dg-do compile } */
+ /* { dg-options "-ffast-math" } */
+ 
+ void foo (long double *x)
+ {
+   __builtin_sincosl (*x, x, x);
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]