diff options
author | Richard Biener <rguenther@suse.de> | 2013-01-07 15:34:43 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-01-07 15:34:43 +0000 |
commit | 3626621a07bd682cb31ea832d2034776dde4e780 (patch) | |
tree | 4175c00ea44d892ce1035c8ff1cbaf29665e98fe /gcc/tree-ssa-strlen.c | |
parent | 8b2ea410c7d5ccc14b94447d449abdc0b4d547ac (diff) | |
download | gcc-3626621a07bd682cb31ea832d2034776dde4e780.zip gcc-3626621a07bd682cb31ea832d2034776dde4e780.tar.gz gcc-3626621a07bd682cb31ea832d2034776dde4e780.tar.bz2 |
re PR tree-optimization/55890 (calling a builtin func through a cast triggers an ICE)
2013-01-07 Richard Biener <rguenther@suse.de>
PR middle-end/55890
* gimple.h (gimple_call_builtin_p): New overload.
* gimple.c (validate_call): New function.
(gimple_call_builtin_p): Likewise.
* tree-ssa-structalias.c (find_func_aliases_for_builtin_call):
Use gimple_call_builtin_p.
(find_func_clobbers): Likewise.
* tree-ssa-strlen.c (adjust_last_stmt): Likewise.
(strlen_optimize_stmt): Likewise.
* gcc.dg/torture/pr55890-1.c: New testcase.
* gcc.dg/torture/pr55890-2.c: Likewise.
From-SVN: r194975
Diffstat (limited to 'gcc/tree-ssa-strlen.c')
-rw-r--r-- | gcc/tree-ssa-strlen.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index aa8b3d6..a574a83 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -807,12 +807,10 @@ adjust_last_stmt (strinfo si, gimple stmt, bool is_strcat) return; } - if (!is_gimple_call (last.stmt)) - return; - callee = gimple_call_fndecl (last.stmt); - if (callee == NULL_TREE || DECL_BUILT_IN_CLASS (callee) != BUILT_IN_NORMAL) + if (!gimple_call_builtin_p (last.stmt, BUILT_IN_NORMAL)) return; + callee = gimple_call_fndecl (last.stmt); switch (DECL_FUNCTION_CODE (callee)) { case BUILT_IN_MEMCPY: @@ -1750,7 +1748,7 @@ strlen_optimize_stmt (gimple_stmt_iterator *gsi) if (is_gimple_call (stmt)) { tree callee = gimple_call_fndecl (stmt); - if (callee && DECL_BUILT_IN_CLASS (callee) == BUILT_IN_NORMAL) + if (gimple_call_builtin_p (stmt, BUILT_IN_NORMAL)) switch (DECL_FUNCTION_CODE (callee)) { case BUILT_IN_STRLEN: |