re PR middle-end/66345 (internal compiler error: Segmentation fault)
PR middle-end/66345 * gimple-fold.c (gimple_fold_builtin_snprintf): Return false if get_maxval_strlen does not produce an INTEGER_CST. * gcc.dg/torture/pr66345.c: New test. From-SVN: r224016
This commit is contained in:
parent
fc7e20fd7a
commit
af9db3a7b0
@ -1,3 +1,9 @@
|
||||
2015-06-02 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR middle-end/66345
|
||||
* gimple-fold.c (gimple_fold_builtin_snprintf): Return false if
|
||||
get_maxval_strlen does not produce an INTEGER_CST.
|
||||
|
||||
2015-06-02 Richard Sandiford <richard.sandiford@arm.com>
|
||||
|
||||
* config/arc/constraints.md: Use lower-case names in match_code.
|
||||
|
@ -2530,7 +2530,7 @@ gimple_fold_builtin_snprintf (gimple_stmt_iterator *gsi)
|
||||
return false;
|
||||
|
||||
tree orig_len = get_maxval_strlen (orig, 0);
|
||||
if (!orig_len)
|
||||
if (!orig_len || TREE_CODE (orig_len) != INTEGER_CST)
|
||||
return false;
|
||||
|
||||
/* We could expand this as
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-06-02 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR middle-end/66345
|
||||
* gcc.dg/torture/pr66345.c: New test.
|
||||
|
||||
2015-06-02 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/65961
|
||||
|
10
gcc/testsuite/gcc.dg/torture/pr66345.c
Normal file
10
gcc/testsuite/gcc.dg/torture/pr66345.c
Normal file
@ -0,0 +1,10 @@
|
||||
/* { dg-do compile } */
|
||||
|
||||
extern int snprintf (char *, unsigned long, const char *, ...);
|
||||
const char a[] = "";
|
||||
int b;
|
||||
void
|
||||
get_bar ()
|
||||
{
|
||||
snprintf (0, 0, "%s", &a[b]);
|
||||
}
|
Loading…
Reference in New Issue
Block a user