public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Honggyu Kim <hong.gyu.kim@lge.com>
To: gcc-patches@gcc.gnu.org
Cc: Honggyu Kim <hong.gyu.kim@lge.com>
Subject: [PATCH][ARM] New testcase to check parameter passing bug
Date: Fri, 13 Mar 2015 02:08:00 -0000	[thread overview]
Message-ID: <1426212518-14867-1-git-send-email-hong.gyu.kim@lge.com> (raw)

Hi,

I have wrote a testcase that reproduces argument overwriting bug during arm
code generation.

I wrote this testcase with the help of Mikael Pettersson.
If some format is not proper to run in gcc testsuite framework, please
correct me.

Please refer to the following bugzilla link for details:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65358

Honggyu
---
 gcc/testsuite/ChangeLog                |    5 +++++
 gcc/testsuite/gcc.target/arm/pr65358.c |   34 ++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/arm/pr65358.c

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5302dbd..9acd12a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-13  Honggyu Kim  <hong.gyu.kim@lge.com>
+
+	PR target/65235
+	* gcc.target/arm/pr65358.c: New test for sibcall argument passing bug.
+
 2015-03-12  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
 	PR rtl-optimization/65235
diff --git a/gcc/testsuite/gcc.target/arm/pr65358.c b/gcc/testsuite/gcc.target/arm/pr65358.c
new file mode 100644
index 0000000..d663dcf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/pr65358.c
@@ -0,0 +1,34 @@
+/* PR target/65358 */
+/* { dg-do compile { target arm*-*-* } } */
+/* { dg-options "-O2" } */
+
+struct pack
+{
+  int fine;
+  int victim;
+  int killer;
+};
+
+int __attribute__ ((__noinline__, __noclone__))
+bar (int a, int b, struct pack p)
+{
+  if (a != 20 || b != 30)
+    __builtin_abort ();
+  if (p.fine != 40 || p.victim != 50 || p.killer != 60)
+    __builtin_abort ();
+  return 0;
+}
+
+int __attribute__ ((__noinline__, __noclone__))
+foo (int arg1, int arg2, int arg3, struct pack p)
+{
+  return bar (arg2, arg3, p);
+}
+
+int main (void)
+{
+  struct pack p = { 40, 50, 60 };
+
+  (void) foo (10, 20, 30, p);
+  return 0;
+}
-- 
1.7.9.5

             reply	other threads:[~2015-03-13  2:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13  2:08 Honggyu Kim [this message]
2015-03-13 12:04 ` Kyrill Tkachov
2015-03-13 13:04   ` Christophe Lyon
2015-03-13 14:12   ` Segher Boessenkool
2015-03-16  0:54     ` Honggyu Kim
2015-03-18 11:53       ` Kyrill Tkachov
2015-03-19  1:40         ` [PATCH v2] " Honggyu Kim
2015-03-19  1:58           ` Honggyu Kim
2015-03-25 13:52           ` Jeff Law
2015-03-25 14:05             ` Kyrill Tkachov
2015-03-29 11:36               ` Honggyu Kim

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=1426212518-14867-1-git-send-email-hong.gyu.kim@lge.com \
    --to=hong.gyu.kim@lge.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).