Commit af9db3a7 by Marek Polacek Committed by Marek Polacek

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
parent fc7e20fd
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> 2015-06-02 Richard Sandiford <richard.sandiford@arm.com>
* config/arc/constraints.md: Use lower-case names in match_code. * config/arc/constraints.md: Use lower-case names in match_code.
......
...@@ -2530,7 +2530,7 @@ gimple_fold_builtin_snprintf (gimple_stmt_iterator *gsi) ...@@ -2530,7 +2530,7 @@ gimple_fold_builtin_snprintf (gimple_stmt_iterator *gsi)
return false; return false;
tree orig_len = get_maxval_strlen (orig, 0); tree orig_len = get_maxval_strlen (orig, 0);
if (!orig_len) if (!orig_len || TREE_CODE (orig_len) != INTEGER_CST)
return false; return false;
/* We could expand this as /* We could expand this as
......
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> 2015-06-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/65961 PR tree-optimization/65961
......
/* { 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]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment