This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR67741
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 29 Sep 2015 14:59:09 +0200 (CEST)
- Subject: [PATCH] Fix PR67741
- Authentication-results: sourceware.org; auth=none
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2015-09-29 Richard Biener <rguenther@suse.de>
PR tree-optimization/67741
* tree-ssa-math-opts.c (pass_cse_sincos::execute): Only recognize
builtin calls with correct signature.
* gcc.dg/torture/pr67741.c: New testcase.
Index: gcc/tree-ssa-math-opts.c
===================================================================
*** gcc/tree-ssa-math-opts.c (revision 228115)
--- gcc/tree-ssa-math-opts.c (working copy)
*************** pass_cse_sincos::execute (function *fun)
*** 1738,1752 ****
of a basic block. */
cleanup_eh = false;
! if (is_gimple_call (stmt)
! && gimple_call_lhs (stmt)
! && (fndecl = gimple_call_fndecl (stmt))
! && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
{
tree arg, arg0, arg1, result;
HOST_WIDE_INT n;
location_t loc;
switch (DECL_FUNCTION_CODE (fndecl))
{
CASE_FLT_FN (BUILT_IN_COS):
--- 1738,1751 ----
of a basic block. */
cleanup_eh = false;
! if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL)
! && gimple_call_lhs (stmt))
{
tree arg, arg0, arg1, result;
HOST_WIDE_INT n;
location_t loc;
+ fndecl = gimple_call_fndecl (stmt);
switch (DECL_FUNCTION_CODE (fndecl))
{
CASE_FLT_FN (BUILT_IN_COS):
Index: gcc/testsuite/gcc.dg/torture/pr67741.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr67741.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr67741.c (working copy)
***************
*** 0 ****
--- 1,13 ----
+ /* { dg-do compile } */
+
+ struct singlecomplex { float real, imag ; } ;
+ struct doublecomplex { double real, imag ; } ;
+ struct extendedcomplex { long double real, imag ; } ;
+ extern double cabs();
+ float cabsf(fc)
+ struct singlecomplex fc; /* { dg-warning "doesn't match" } */
+ {
+ struct doublecomplex dc ;
+ dc.real=fc.real; dc.imag=fc.imag;
+ return (float) cabs(dc);
+ }