This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [4.8 branch] PR rtl-optimization/60700: Backport revision 201326
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Eric Botcazou <ebotcazou at adacore dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 31 Mar 2014 08:30:44 -0700
- Subject: Re: [PATCH] [4.8 branch] PR rtl-optimization/60700: Backport revision 201326
- Authentication-results: sourceware.org; auth=none
- References: <20140328215933 dot GA31437 at intel dot com> <16261797 dot CAtWvAeyxj at polaris> <20140329084742 dot GR1817 at tucnak dot redhat dot com> <CAMe9rOoN4VP7Bb5udTP0RQbtqovny-Xk2C91tFboAUkFVa4j_w at mail dot gmail dot com>
On Sat, Mar 29, 2014 at 7:34 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Saturday, March 29, 2014, Jakub Jelinek <jakub@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.lu@intel.com>
+
+ PR rtl-optimization/60700
+ * gcc.target/i386/pr60700.c: New test.
+
2014-03-31 Ramana Radhakrishnan <ramana.radhakrishnan@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;
+}