From 56b6687b9ea6124dd91ae0d689db1db3acc98e63 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 6 Aug 2011 14:57:52 +0000 Subject: [PATCH] Add testcases for PR 47381. 2011-08-06 H.J. Lu PR target/47381 * gcc.dg/pr47381-1.c: New. * gcc.dg/pr47381-2.c: Likewise. * gcc.target/i386/pr47381.c: Likewise. From-SVN: r177514 --- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.dg/pr47381-1.c | 26 +++++++++++++++++++++++++ gcc/testsuite/gcc.dg/pr47381-2.c | 13 +++++++++++++ gcc/testsuite/gcc.target/i386/pr47381.c | 13 +++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr47381-1.c create mode 100644 gcc/testsuite/gcc.dg/pr47381-2.c create mode 100644 gcc/testsuite/gcc.target/i386/pr47381.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 94f6f081b0c..e5f649caa7d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-08-06 H.J. Lu + + PR target/47381 + * gcc.dg/pr47381-1.c: New. + * gcc.dg/pr47381-2.c: Likewise. + * gcc.target/i386/pr47381.c: Likewise. + 2011-08-06 H.J. Lu PR middle-end/47727 diff --git a/gcc/testsuite/gcc.dg/pr47381-1.c b/gcc/testsuite/gcc.dg/pr47381-1.c new file mode 100644 index 00000000000..738a892083b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr47381-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef unsigned IPos; +typedef unsigned char uch; +extern uch window[]; +unsigned max_chain_length; +unsigned strstart; +int longest_match(IPos cur_match, int len, int best_len) +{ + unsigned chain_length = max_chain_length; + register uch *scan = window + strstart; + register uch *match; + register uch scan_end1 = scan[best_len-1]; + register uch scan_end = scan[best_len]; + do { + ; + match = window + cur_match; + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + best_len = len; + } while ( --chain_length != 0); + return best_len; +} diff --git a/gcc/testsuite/gcc.dg/pr47381-2.c b/gcc/testsuite/gcc.dg/pr47381-2.c new file mode 100644 index 00000000000..8aa7be720a0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr47381-2.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef unsigned long ulg; +long block_start; +typedef unsigned char uch; +extern uch window[]; + unsigned strstart; +ulg flush_block (char *buf, ulg stored_len, int eof); +ulg deflate() +{ + return flush_block(block_start >= 0L ? (char*)&window[(unsigned)block_start] : (char*)((void *)0), (long)strstart - block_start, (1)); +} diff --git a/gcc/testsuite/gcc.target/i386/pr47381.c b/gcc/testsuite/gcc.target/i386/pr47381.c new file mode 100644 index 00000000000..c4b2127c286 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr47381.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=atom" } */ + +struct foo_t { + int limit; +} foo[3]; +void +bar () { + int i; + for (i = 0; i < 3; i++) { + __builtin_memset (&foo[i], 0, sizeof(*foo)); + } +} -- 2.30.2