re PR middle-end/37669 (ice for legal code with -O2)
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. From-SVN: r141270
This commit is contained in:
parent
3b8031bb31
commit
d9cc481a35
@ -1,3 +1,9 @@
|
||||
2008-10-21 Adam Nemet <anemet@caviumnetworks.com>
|
||||
|
||||
PR middle-end/37669
|
||||
* tree-ssa-ccp.c (ccp_fold_builtin): Only allow one argument to be
|
||||
processed by get_maxval_strlen.
|
||||
|
||||
2008-10-21 David Edelsohn <edelsohn@gnu.org>
|
||||
|
||||
PR target/35485
|
||||
|
@ -1,3 +1,8 @@
|
||||
2008-10-21 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/37669
|
||||
* gcc.c-torture/compile/pr37669-2.c: New test.
|
||||
|
||||
2008-10-21 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* gcc.dg/tree-ssa/alias-19.c: New testcase.
|
||||
|
14
gcc/testsuite/gcc.c-torture/compile/pr37669-2.c
Normal file
14
gcc/testsuite/gcc.c-torture/compile/pr37669-2.c
Normal file
@ -0,0 +1,14 @@
|
||||
/* PR middle-end/37669 */
|
||||
|
||||
#define FMT10 "%d%d%d%d%d%d%d%d%d%d"
|
||||
#define FMT100 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10 FMT10
|
||||
#define FMT1000 FMT100 FMT100 FMT100 FMT100 FMT100 \
|
||||
FMT100 FMT100 FMT100 FMT100 FMT100
|
||||
#define ARG10 , i, i, i, i, i, i, i, i, i, i
|
||||
#define ARG100 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10 ARG10
|
||||
#define ARG1000 ARG100 ARG100 ARG100 ARG100 ARG100 \
|
||||
ARG100 ARG100 ARG100 ARG100 ARG100
|
||||
void foo (char *s, int i, int j)
|
||||
{
|
||||
__builtin___snprintf_chk (s, i, 1, j, FMT1000 ARG1000);
|
||||
}
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user