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
+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.
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
+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
--- /dev/null
+/* { 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]);
+}