From: "H.J. Lu" <hjl.tools@gmail.com>
To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: Joseph Myers <joseph@codesourcery.com>,
Jason Merrill <jason@redhat.com>,
Ulrich Weigand <uweigand@de.ibm.com>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Jakub Jelinek <jakub@redhat.com>,
Richard Biener <richard.guenther@gmail.com>,
Markus Trippelsdorf <markus@trippelsdorf.de>
Subject: Re: PING^1: [PATCH] Add TYPE_EMPTY_RECORD for C++ empty class
Date: Wed, 16 Mar 2016 11:53:00 -0000 [thread overview]
Message-ID: <CAMe9rOpQLPuSHKdJZ7i5zEyTo02zKh6smTeWYXzkD2eaNCS7XA@mail.gmail.com> (raw)
In-Reply-To: <CE42174E-B290-4DC5-93FD-375654C4223F@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 798 bytes --]
On Wed, Mar 16, 2016 at 2:45 AM, Bernhard Reutner-Fischer
<rep.dot.nop@gmail.com> wrote:
> On March 16, 2016 3:17:20 AM GMT+01:00, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>
>>> Where is the current definition of empty types you're proposing for
>>use in
>>> GCC? Is the behavior of this case clear from that definition?
>>
>>https://gcc.gnu.org/ml/gcc/2016-03/msg00071.html
>>
>>Jason's patch follows it. Here is a test for struct with zero-size
>>array of empty type, which is treated as empty type.
>
> index 0000000..489eb3a
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/abi/empty19.C
> @@ -0,0 +1,17 @@
> +// PR c++/60336
> +// { dg-do run }
> +// { dg-options "-Wabi=9 -x c" }
> +// { dg-additional-sources "empty14a.c" }
>
> 14a ? Not 19a ?
> Thanks
>
>
Here is the updated patch.
--
H.J.
[-- Attachment #2: 0001-Add-a-test-for-struct-with-zero-size-array-of-empty-.patch --]
[-- Type: text/x-patch, Size: 1816 bytes --]
From d7da4b56dddbd75da163b9fd3cc9ff4241be6ca9 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 15 Mar 2016 19:14:30 -0700
Subject: [PATCH] Add a test for struct with zero-size array of empty type
---
gcc/testsuite/g++.dg/abi/empty19.C | 17 +++++++++++++++++
gcc/testsuite/g++.dg/abi/empty19.h | 10 ++++++++++
gcc/testsuite/g++.dg/abi/empty19a.c | 6 ++++++
3 files changed, 33 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/abi/empty19.C
create mode 100644 gcc/testsuite/g++.dg/abi/empty19.h
create mode 100644 gcc/testsuite/g++.dg/abi/empty19a.c
diff --git a/gcc/testsuite/g++.dg/abi/empty19.C b/gcc/testsuite/g++.dg/abi/empty19.C
new file mode 100644
index 0000000..e3e855a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/empty19.C
@@ -0,0 +1,17 @@
+// PR c++/60336
+// { dg-do run }
+// { dg-options "-Wabi=9 -x c" }
+// { dg-additional-sources "empty19a.c" }
+// { dg-prune-output "command line option" }
+
+#include "empty19.h"
+extern "C" void fun(struct dummy, struct foo);
+
+int main()
+{
+ struct dummy d;
+ struct foo f = { -1, -2, -3, -4, -5 };
+
+ fun(d, f); // { dg-warning "empty" }
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/abi/empty19.h b/gcc/testsuite/g++.dg/abi/empty19.h
new file mode 100644
index 0000000..616b87b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/empty19.h
@@ -0,0 +1,10 @@
+struct dummy0 { };
+struct dummy { struct dummy0 d[0]; };
+struct foo
+{
+ int i1;
+ int i2;
+ int i3;
+ int i4;
+ int i5;
+};
diff --git a/gcc/testsuite/g++.dg/abi/empty19a.c b/gcc/testsuite/g++.dg/abi/empty19a.c
new file mode 100644
index 0000000..767b1eb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/empty19a.c
@@ -0,0 +1,6 @@
+#include "empty19.h"
+void fun(struct dummy d, struct foo f)
+{
+ if (f.i1 != -1)
+ __builtin_abort();
+}
--
2.5.0
next prev parent reply other threads:[~2016-03-16 11:53 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-08 16:22 H.J. Lu
2015-12-09 14:05 ` Richard Biener
2015-12-09 18:53 ` H.J. Lu
2015-12-09 21:14 ` H.J. Lu
2015-12-09 21:31 ` Markus Trippelsdorf
2015-12-10 11:24 ` Richard Biener
2015-12-11 23:52 ` H.J. Lu
2015-12-12 14:51 ` Jason Merrill
2015-12-12 15:27 ` Jakub Jelinek
2015-12-12 16:45 ` H.J. Lu
2015-12-12 18:43 ` Marc Glisse
2015-12-14 20:16 ` Jason Merrill
2015-12-14 20:39 ` H.J. Lu
2015-12-14 20:44 ` Jason Merrill
2015-12-14 22:08 ` H.J. Lu
2016-01-26 19:27 ` Jason Merrill
2016-01-26 19:52 ` H.J. Lu
2016-01-26 20:23 ` Marc Glisse
2016-01-26 20:26 ` H.J. Lu
2016-01-26 20:44 ` Marc Glisse
2016-01-26 21:21 ` H.J. Lu
2016-01-26 21:40 ` Jakub Jelinek
2016-01-26 22:21 ` H.J. Lu
2016-01-27 8:10 ` Marc Glisse
2016-01-27 8:21 ` Jakub Jelinek
2016-01-27 9:03 ` Marc Glisse
2016-01-27 13:46 ` H.J. Lu
2016-01-27 15:39 ` H.J. Lu
2016-03-01 1:02 ` Jason Merrill
2016-03-01 22:44 ` H.J. Lu
2016-03-02 16:25 ` Ulrich Weigand
2016-03-02 17:34 ` H.J. Lu
2016-03-15 15:35 ` Jason Merrill
2016-03-15 16:00 ` H.J. Lu
2016-03-15 19:32 ` Jason Merrill
2016-03-16 12:38 ` H.J. Lu
2016-03-16 16:58 ` Jason Merrill
2016-03-16 17:02 ` H.J. Lu
2016-03-16 19:39 ` H.J. Lu
2016-03-16 19:43 ` Jason Merrill
2016-03-15 21:40 ` Joseph Myers
2016-03-15 22:31 ` H.J. Lu
2016-03-15 22:35 ` Joseph Myers
2016-03-16 0:23 ` H.J. Lu
2016-03-16 0:25 ` Joseph Myers
2016-03-16 2:17 ` H.J. Lu
2016-03-16 9:46 ` Bernhard Reutner-Fischer
2016-03-16 11:53 ` H.J. Lu [this message]
2016-03-16 2:51 ` Jason Merrill
2016-03-16 11:55 ` H.J. Lu
2016-03-16 14:33 ` Jason Merrill
2016-03-16 14:48 ` H.J. Lu
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=CAMe9rOpQLPuSHKdJZ7i5zEyTo02zKh6smTeWYXzkD2eaNCS7XA@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.com \
--cc=markus@trippelsdorf.de \
--cc=rep.dot.nop@gmail.com \
--cc=richard.guenther@gmail.com \
--cc=uweigand@de.ibm.com \
/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).