diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-12-02 18:14:18 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-12-02 18:14:18 +0100 |
commit | fe5c443ea50fd90cba2352d5482d709fd2511d5b (patch) | |
tree | 39bbecf80e9d1c5b798a7278196759f5812197f4 /gcc | |
parent | 09ce620eab8a5597b706f25d918c21643c0a9f0b (diff) | |
download | gcc-fe5c443ea50fd90cba2352d5482d709fd2511d5b.zip gcc-fe5c443ea50fd90cba2352d5482d709fd2511d5b.tar.gz gcc-fe5c443ea50fd90cba2352d5482d709fd2511d5b.tar.bz2 |
re PR middle-end/38343 (ice for legal code with -O2)
PR middle-end/38343
* builtins.c (fold_builtin_memory_op): Convert len to sizetype
before using it in POINTER_PLUS_EXPR.
* gcc.c-torture/compile/pr38343-2.c: New test.
From-SVN: r142363
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/builtins.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr38343-2.c | 12 |
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 843b221..a0a839c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-12-02 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/38343 + * builtins.c (fold_builtin_memory_op): Convert len to sizetype + before using it in POINTER_PLUS_EXPR. + 2008-12-02 Richard Guenther <rguenther@suse.de> PR tree-optimization/38359 diff --git a/gcc/builtins.c b/gcc/builtins.c index 3406667..444baa6 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -8993,6 +8993,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i len = fold_build2 (MINUS_EXPR, TREE_TYPE (len), len, ssize_int (1)); + len = fold_convert (sizetype, len); dest = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dest), dest, len); dest = fold_convert (type, dest); if (expr) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 33d0f86..a08d83b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-12-02 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/38343 + * gcc.c-torture/compile/pr38343-2.c: New test. + 2008-12-02 Richard Guenther <rguenther@suse.de> PR tree-optimization/38359 diff --git a/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c b/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c new file mode 100644 index 0000000..8444cc7 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr38343-2.c @@ -0,0 +1,12 @@ +/* PR middle-end/38343 */ + +static struct S +{ + char f[6]; +} s[] = { {"01000"} }; + +char * +foo (void) +{ + return __builtin_stpcpy (s[0].f, "S0022"); +} |