aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-06-21 08:59:33 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-06-21 08:59:33 +0200
commit0ad84f34fc91885b187c302c8abf1dd6bae4a671 (patch)
treee44c3058192b42758cc768621ec38577922dc5f1 /gcc/testsuite/gcc.dg
parente71e8d944ff47afe91ed2610d71b1a11f85f93c5 (diff)
downloadgcc-0ad84f34fc91885b187c302c8abf1dd6bae4a671.zip
gcc-0ad84f34fc91885b187c302c8abf1dd6bae4a671.tar.gz
gcc-0ad84f34fc91885b187c302c8abf1dd6bae4a671.tar.bz2
re PR tree-optimization/71588 (ICE on valid code at -O2 and -O3 on x86_64-linux-gnu: in execute_todo, at passes.c:2009)
PR tree-optimization/71588 * tree-ssa-strlen.c (valid_builtin_call): New function. (adjust_last_stmt, handle_builtin_memset, strlen_optimize_stmt): Use it. * gcc.dg/pr71558.c: New test. From-SVN: r237628
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/pr71558.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr71558.c b/gcc/testsuite/gcc.dg/pr71558.c
new file mode 100644
index 0000000..33a648e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr71558.c
@@ -0,0 +1,17 @@
+/* PR tree-optimization/71588 */
+
+/* strcpy must not be pure, but make sure we don't ICE even when
+ it is declared incorrectly. */
+char *strcpy (char *, const char *) __attribute__ ((__pure__));
+__SIZE_TYPE__ strlen (const char *);
+void *malloc (__SIZE_TYPE__);
+
+char a[20];
+
+char *
+foo (void)
+{
+ __SIZE_TYPE__ b = strlen (a);
+ char *c = malloc (b);
+ return strcpy (c, a);
+}