public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [committed] Fix up 20071018-1.c testcase (PR testsuite/55504)
Date: Wed, 28 Nov 2012 16:31:00 -0000	[thread overview]
Message-ID: <20121128163018.GO2315@tucnak.redhat.com> (raw)

Hi!

As discussed on IRC, this testcase clobbers memory before malloc returned
chunk, fixed thusly, tested on x86_64-linux, committed to trunk.

2012-11-28  Jakub Jelinek  <jakub@redhat.com>

	PR testsuite/55504
	* gcc.c-torture/execute/20071018-1.c (foo): Add noinline/noclone
	attributes.  Avoid clobbering memory before malloced chunk.
	(main): Pass 1 instead of 0 as argument.

--- gcc/testsuite/gcc.c-torture/execute/20071018-1.c.jj	2008-09-05 12:54:12.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/execute/20071018-1.c	2012-11-28 13:42:10.583890553 +0100
@@ -13,11 +13,11 @@ void __attribute__((noinline)) bar(struc
 {
   *f = __builtin_malloc(sizeof(struct foo));
 }
-struct foo * foo(int rank)
+struct foo * __attribute__((noinline, noclone)) foo(int rank)
 {
   void *x = __builtin_malloc(sizeof(struct mem));
   struct mem *as = x;
-  struct foo **upper = &as->x[rank * 8 - 1];
+  struct foo **upper = &as->x[rank * 8 - 5];
   *upper = 0;
   bar(upper);
   return *upper;
@@ -25,7 +25,7 @@ struct foo * foo(int rank)
 
 int main()
 {
-  if (foo(0) == 0)
+  if (foo(1) == 0)
     abort ();
   return 0;
 }

	Jakub

                 reply	other threads:[~2012-11-28 16:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121128163018.GO2315@tucnak.redhat.com \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).