]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR middle-end/40291 (ICE on unprototyped memcmp with long long last...
authorRichard Guenther <rguenther@suse.de>
Fri, 10 Jul 2009 16:01:34 +0000 (16:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 10 Jul 2009 16:01:34 +0000 (16:01 +0000)
2009-07-10  Richard Guenther  <rguenther@suse.de>

Backport from mainline
2009-05-29  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/40291
* builtins.c (expand_builtin_memcmp): Convert len to sizetype
before expansion.

* gcc.c-torture/compile/pr40291.c: New test.

From-SVN: r149487

gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr40291.c [new file with mode: 0644]

index 921b6c88566c99ca1a4105f9e44ae0ac3ba24f26..282148ea546fb7899d018f7fe02cd607f322945c 100644 (file)
@@ -1,3 +1,12 @@
+2009-07-10  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
+       2009-05-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/40291
+       * builtins.c (expand_builtin_memcmp): Convert len to sizetype
+       before expansion.
+
 2009-07-10  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
index d61651e77283932d2c7724db7c9403bb1fc6a360..82bc24f84ba3f002d8e2c8586a196a90866c6928 100644 (file)
@@ -4119,7 +4119,7 @@ expand_builtin_memcmp (tree exp, rtx target, enum machine_mode mode)
 
     arg1_rtx = get_memory_rtx (arg1, len);
     arg2_rtx = get_memory_rtx (arg2, len);
-    arg3_rtx = expand_normal (len);
+    arg3_rtx = expand_normal (fold_convert (sizetype, len));
 
     /* Set MEM_SIZE as appropriate.  */
     if (GET_CODE (arg3_rtx) == CONST_INT)
index de50754b7d68f45e5e6a2e1391eb83cac5553a3a..b3cc101ee35b91b24aa3725285b47151a5c485dd 100644 (file)
@@ -1,3 +1,11 @@
+2009-07-10  Richard Guenther  <rguenther@suse.de>
+
+       Backport from mainline
+       2009-05-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/40291
+       * gcc.c-torture/compile/pr40291.c: New test.
+
 2009-07-10  Richard Guenther  <rguenther@suse.de>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40291.c b/gcc/testsuite/gcc.c-torture/compile/pr40291.c
new file mode 100644 (file)
index 0000000..d50bbee
--- /dev/null
@@ -0,0 +1,7 @@
+/* PR middle-end/40291 */
+
+int
+foo (void *x, char *y, unsigned long long z)
+{
+  return memcmp (x, y, z);
+}