On Sat, Mar 29, 2014 at 7:34 AM, H.J. Lu <hjl.to...@gmail.com> wrote:
> On Saturday, March 29, 2014, Jakub Jelinek <ja...@redhat.com> wrote:
>>
>> On Sat, Mar 29, 2014 at 09:38:38AM +0100, Eric Botcazou wrote:
>> > > Revision 201326 fixes a shrink-wrap bug which is also a regression
>> > > on 4.8 branch.  This patch backports it to 4.8 branch.  OK for 4.8
>> > > branch.
>> >
>> > Yes, thanks.
>> >
>> > > I also include a testcase for PR rtl-optimization/60700.  OK for
>> > > trunk and 4.8 branch?
>> >
>> > I'd remove #include <stddef.h>.
>>
>> You'd then have to use __SIZE_TYPE__ in malloc prototype or just drop
>> the prototype and use __builtin_malloc.
>>
>>         Jakub
>
> It also needs NULL. <stddef.h> is provided by GCC. It should be OK.
>

This is the patch I checked in.

-- 
H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog (revision 208961)
+++ ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2014-03-31  H.J. Lu  <hongjiu...@intel.com>
+
+ PR rtl-optimization/60700
+ * gcc.target/i386/pr60700.c: New test.
+
 2014-03-31  Ramana Radhakrishnan  <ramana.radhakrish...@arm.com>

  PR target/60650
Index: gcc.target/i386/pr60700.c
===================================================================
--- gcc.target/i386/pr60700.c (revision 0)
+++ gcc.target/i386/pr60700.c (working copy)
@@ -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;
+}

Reply via email to