From: H.J. Lu Date: Mon, 31 Mar 2014 15:24:56 +0000 (+0000) Subject: Add a testcase for PR rtl-optimization/60700 X-Git-Tag: basepoints/gcc-5~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a283136a5870513f1ec4d7d9a0b3b2cc1771baf4;p=thirdparty%2Fgcc.git Add a testcase for PR rtl-optimization/60700 PR rtl-optimization/60700 * gcc.target/i386/pr60700.c: New test. From-SVN: r208962 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 532bba6ea6ab..ccffd4965a72 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-31 H.J. Lu + + PR rtl-optimization/60700 + * gcc.target/i386/pr60700.c: New test. + 2014-03-31 Ramana Radhakrishnan PR target/60650 diff --git a/gcc/testsuite/gcc.target/i386/pr60700.c b/gcc/testsuite/gcc.target/i386/pr60700.c new file mode 100644 index 000000000000..5428f3616237 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr60700.c @@ -0,0 +1,59 @@ +/* PR rtl-optimization/60700 */ +/* { dg-do run { target ia32 } } */ +/* { dg-options "-O3 -march=i686" } */ + +int +__attribute__((noinline)) +foo (void) +{ + return 0; +} + +void *g = (void *)1; + +struct st { + char data[36]; /* must be greater than 32. */ +}; + +int +__attribute__((noinline)) +repro(struct st **out) +{ + int status = 0; + + *out = 0; + + status = foo(); + if (status != 0) { + return status; + } + + if (0 == g) { + status = 999; + return status; + } + + *out = (struct st *)__builtin_malloc(sizeof(struct st)); + if (0 == *out) { + status = 42; + return status; + } + + __builtin_memset(*out, 0, sizeof(struct st)); + + return status; +} + +int +main () +{ + struct st *p; + int ret = repro (&p); + unsigned int i; + + for (i = 0; i < sizeof (p->data)/sizeof (p->data[0]); i++) + if (p->data[i] != 0) + __builtin_abort (); + + return ret; +}