From: Richard Guenther Date: Fri, 10 Jul 2009 16:01:34 +0000 (+0000) Subject: backport: re PR middle-end/40291 (ICE on unprototyped memcmp with long long last... X-Git-Tag: releases/gcc-4.3.4~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7750236cb3d9623c00d1dea6301eb691aad5197;p=thirdparty%2Fgcc.git backport: re PR middle-end/40291 (ICE on unprototyped memcmp with long long last argument) 2009-07-10 Richard Guenther Backport from mainline 2009-05-29 Jakub Jelinek 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 921b6c88566c..282148ea546f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-07-10 Richard Guenther + + Backport from mainline + 2009-05-29 Jakub Jelinek + + PR middle-end/40291 + * builtins.c (expand_builtin_memcmp): Convert len to sizetype + before expansion. + 2009-07-10 Richard Guenther Backport from mainline diff --git a/gcc/builtins.c b/gcc/builtins.c index d61651e77283..82bc24f84ba3 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de50754b7d68..b3cc101ee35b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2009-07-10 Richard Guenther + + Backport from mainline + 2009-05-29 Jakub Jelinek + + PR middle-end/40291 + * gcc.c-torture/compile/pr40291.c: New test. + 2009-07-10 Richard Guenther 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 index 000000000000..d50bbee66080 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40291.c @@ -0,0 +1,7 @@ +/* PR middle-end/40291 */ + +int +foo (void *x, char *y, unsigned long long z) +{ + return memcmp (x, y, z); +}