diff options
author | nemet <nemet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-21 17:46:53 +0000 |
---|---|---|
committer | nemet <nemet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-21 17:46:53 +0000 |
commit | be9f921eb27de7f5f22e4755df15340ab8042a09 (patch) | |
tree | d4bce270480b6099fbe304abed7acfee99502ad2 /gcc/tree-ssa-ccp.c | |
parent | 24e20bcd26f95de1f2cb7d6547253aa5fc9152c8 (diff) | |
download | gcc-be9f921eb27de7f5f22e4755df15340ab8042a09.tar.gz |
PR middle-end/37669
* tree-ssa-ccp.c (ccp_fold_builtin): Only allow one argument to be
processed by get_maxval_strlen.
testsuite/
PR middle-end/37669
* gcc.c-torture/compile/pr37669-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141270 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r-- | gcc/tree-ssa-ccp.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index 383367e9fb1..0365697fc85 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -2430,7 +2430,7 @@ ccp_fold_builtin (gimple stmt) { tree result, val[3]; tree callee, a; - int arg_mask, i, type; + int arg_idx, type; bitmap visited; bool ignore; int nargs; @@ -2466,12 +2466,12 @@ ccp_fold_builtin (gimple stmt) case BUILT_IN_STRLEN: case BUILT_IN_FPUTS: case BUILT_IN_FPUTS_UNLOCKED: - arg_mask = 1; + arg_idx = 0; type = 0; break; case BUILT_IN_STRCPY: case BUILT_IN_STRNCPY: - arg_mask = 2; + arg_idx = 1; type = 0; break; case BUILT_IN_MEMCPY_CHK: @@ -2479,17 +2479,17 @@ ccp_fold_builtin (gimple stmt) case BUILT_IN_MEMMOVE_CHK: case BUILT_IN_MEMSET_CHK: case BUILT_IN_STRNCPY_CHK: - arg_mask = 4; + arg_idx = 2; type = 2; break; case BUILT_IN_STRCPY_CHK: case BUILT_IN_STPCPY_CHK: - arg_mask = 2; + arg_idx = 1; type = 1; break; case BUILT_IN_SNPRINTF_CHK: case BUILT_IN_VSNPRINTF_CHK: - arg_mask = 2; + arg_idx = 1; type = 2; break; default: @@ -2498,18 +2498,12 @@ ccp_fold_builtin (gimple stmt) /* Try to use the dataflow information gathered by the CCP process. */ visited = BITMAP_ALLOC (NULL); + bitmap_clear (visited); memset (val, 0, sizeof (val)); - for (i = 0; i < nargs; i++) - { - if ((arg_mask >> i) & 1) - { - a = gimple_call_arg (stmt, i); - bitmap_clear (visited); - if (!get_maxval_strlen (a, &val[i], visited, type)) - val[i] = NULL_TREE; - } - } + a = gimple_call_arg (stmt, arg_idx); + if (!get_maxval_strlen (a, &val[arg_idx], visited, type)) + val[arg_idx] = NULL_TREE; BITMAP_FREE (visited); |