diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-26 22:02:44 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-26 22:02:44 +0000 |
commit | d8ae1baae3e99dfbcbe2e7da2361de13a86d0395 (patch) | |
tree | 98ccbe9ec79be85a6d0adc7e6a8ae4dd1aafc086 /gcc/testsuite | |
parent | 724912572b37ccd8531ff7dfeb33d19ed7742b4a (diff) | |
download | gcc-d8ae1baae3e99dfbcbe2e7da2361de13a86d0395.tar.gz |
PR rtl-optimization/23561
* builtins.c (get_memory_rtx): Add LEN argument. If MEM_EXPR is
a COMPONENT_REF, remove all COMPONENT_REF from MEM_EXPR unless
at most LEN bytes long memory fits into the field.
(expand_builtin_memcpy, expand_builtin_mempcpy, expand_movstr,
expand_builtin_strncpy, expand_builtin_memset, expand_builtin_memcmp,
expand_builtin_strcmp, expand_builtin_strncmp): Adjust callers.
* gcc.c-torture/execute/20050826-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103541 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/20050826-1.c | 44 |
2 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5ca10c9f488..c29bcc020ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2005-08-26 Jakub Jelinek <jakub@redhat.com> + PR rtl-optimization/23561 + * gcc.c-torture/execute/20050826-1.c: New test. + PR rtl-opt/23560 * gcc.c-torture/execute/20050826-2.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/20050826-1.c b/gcc/testsuite/gcc.c-torture/execute/20050826-1.c new file mode 100644 index 00000000000..bc7f94032cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20050826-1.c @@ -0,0 +1,44 @@ +/* PR rtl-optimization/23561 */ + +struct A +{ + char a1[1]; + char a2[5]; + char a3[1]; + char a4[2048 - 7]; +} a; + +typedef __SIZE_TYPE__ size_t; +extern void *memset (void *, int, size_t); +extern void *memcpy (void *, const void *, size_t); +extern int memcmp (const void *, const void *, size_t); +extern void abort (void); + +void +bar (struct A *x) +{ + size_t i; + if (memcmp (x, "\1HELLO\1", sizeof "\1HELLO\1")) + abort (); + for (i = 0; i < sizeof (x->a4); i++) + if (x->a4[i]) + abort (); +} + +int +foo (void) +{ + memset (&a, 0, sizeof (a)); + a.a1[0] = 1; + memcpy (a.a2, "HELLO", sizeof "HELLO"); + a.a3[0] = 1; + bar (&a); + return 0; +} + +int +main (void) +{ + foo (); + return 0; +} |