aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-09-29 13:02:42 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-09-29 13:02:42 +0000
commiteada851cc9fb2822989d3ef81bb5b4b08dcc81a7 (patch)
tree622acbfaa22ecaaa95a141f7bf10c0291f7cd7af /gcc/tree-ssa-math-opts.c
parentce535a9685b11c846560cc0f9f4dded1ca558efc (diff)
downloadgcc-eada851cc9fb2822989d3ef81bb5b4b08dcc81a7.zip
gcc-eada851cc9fb2822989d3ef81bb5b4b08dcc81a7.tar.gz
gcc-eada851cc9fb2822989d3ef81bb5b4b08dcc81a7.tar.bz2
re PR tree-optimization/67741 (Invalid built-in usage should not cause segmentation fault in compiler)
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. From-SVN: r228243
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r--gcc/tree-ssa-math-opts.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 42708ee..9747739 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1738,15 +1738,14 @@ pass_cse_sincos::execute (function *fun)
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)
+ 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):