public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Bin.Cheng <amker.cheng@gmail.com>
Cc: Richard Biener <rguenther@suse.de>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][PR65802] Mark ifn_va_arg with ECF_NOTHROW
Date: Fri, 24 Apr 2015 14:27:00 -0000	[thread overview]
Message-ID: <553A52CA.9090407@mentor.com> (raw)
In-Reply-To: <CAHFci290f=Pq5RqN7V7eNGyNPAASb7z+1=uspiaj+sJgcs_67A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

On 24-04-15 05:25, Bin.Cheng wrote:
> On Tue, Apr 21, 2015 at 3:10 PM, Tom de Vries <Tom_deVries@mentor.com> wrote:
>> Hi,
>>
>> this patch fixes PR65802.
>>
>> diff --git a/gcc/testsuite/g++.dg/
> pr65802.C b/gcc/testsuite/g++.dg/pr65802.C
>> new file mode 100644
>> index 0000000..26e5317
>> --- /dev/null
>> +++ b/gcc/testsuite/g++.dg/pr65802.C
>> @@ -0,0 +1,29 @@
>> +// { dg-do compile }
>> +// { dg-options "-O0" }
>> +
>> +typedef int tf ();
>> +
>> +struct S
>> +{
>> +  tf m_fn1;
>> +} a;
>> +
>> +void
>> +fn1 ()
>> +{
>> +  try
>> +    {
>> +      __builtin_va_list c;
>> +      {
>> +     int *d = __builtin_va_arg (c, int *);
>> +     int **e = &d;
>> +     __asm__("" : "=d"(e));
> Hi, thanks for fixing the issue.
> But 'd' is a machine specific constraint?  This case failed on all arm
> processors.

Hi,

I've rewritten the test-case for C, made the function a valid stdargs function, 
and removed the superfluous inline assembly.

Committed as attached.

Thanks,
- Tom

[-- Attachment #2: 0001-Replace-g-.dg-pr65802.C-with-gcc.dg-pr65802.c.patch --]
[-- Type: text/x-patch, Size: 1388 bytes --]

2015-04-24  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/65802
	* g++.dg/pr65802.C: Move to ...
	* gcc.dg/pr65802.c: ... here.  Add -fexceptions to dg-options. Include
	stdarg.h.  Rewrite for C.
	(fn1): Use va_list and va_arg.  Make variable args function.  Add use of
	va_start and va_end.  Remove unnecessary inline asm.

diff --git a/gcc/testsuite/g++.dg/pr65802.C b/gcc/testsuite/g++.dg/pr65802.C
deleted file mode 100644
index 26e5317..0000000
--- a/gcc/testsuite/g++.dg/pr65802.C
+++ /dev/null
@@ -1,29 +0,0 @@
-// { dg-do compile }
-// { dg-options "-O0" }
-
-typedef int tf ();
-
-struct S
-{
-  tf m_fn1;
-} a;
-
-void
-fn1 ()
-{
-  try
-    {
-      __builtin_va_list c;
-      {
-	int *d = __builtin_va_arg (c, int *);
-	int **e = &d;
-	__asm__("" : "=d"(e));
-	a.m_fn1 ();
-      }
-      a.m_fn1 ();
-    }
-  catch (...)
-    {
-
-    }
-}
diff --git a/gcc/testsuite/gcc.dg/pr65802.c b/gcc/testsuite/gcc.dg/pr65802.c
new file mode 100644
index 0000000..fcec234
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr65802.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O0 -fexceptions" } */
+
+#include <stdarg.h>
+
+struct S
+{
+  int (*m_fn1) (void);
+} a;
+
+void
+fn1 (int d, ...)
+{
+  va_list c;
+  va_start (c, d);
+
+  {
+    int *d = va_arg (c, int *);
+
+    int **e = &d;
+
+    a.m_fn1 ();
+  }
+
+  a.m_fn1 ();
+
+  va_end (c);
+}
-- 
1.9.1


      reply	other threads:[~2015-04-24 14:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21  7:10 Tom de Vries
2015-04-21  7:28 ` Richard Biener
2015-04-21  7:48 ` Jan Hubicka
2015-04-21  7:50   ` Richard Biener
2015-04-26  7:18     ` Tom de Vries
2015-04-24  3:25 ` Bin.Cheng
2015-04-24 14:27   ` Tom de Vries [this message]

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=553A52CA.9090407@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=amker.cheng@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).