From: Jeff Law <law@redhat.com>
To: Eric Botcazou <ebotcazou@adacore.com>, gcc-patches@gcc.gnu.org
Subject: Re: [patch 2/6] scalar-storage-order merge: C front-end
Date: Tue, 13 Oct 2015 11:32:00 -0000 [thread overview]
Message-ID: <561CEBB8.3030002@redhat.com> (raw)
In-Reply-To: <1818790.uuKnpis75z@polaris>
On 10/06/2015 05:02 AM, Eric Botcazou wrote:
> This is the C front-end + C family part.
>
> * doc/extend.texi (type attributes): Document scalar_storage_order.
> (Structure-Packing Pragmas): Rename into...
> (Structure-Layout Pragmas): ...this. Document scalar_storage_order.
> * doc/invoke.texi (C Dialect Options): Document -fsso-struct
> (Warnings): Document -Wno-scalar-storage-order.
> * flag-types.h (enum scalar_storage_order_kind): New enumeration.
> c-family/
> * c-common.c (c_common_attributes): Add scalar_storage_order.
> (handle_scalar_storage_order_attribute): New function.
> * c-pragma.c (global_sso): New variable.
> (maybe_apply_pragma_scalar_storage_order): New function.
> (handle_pragma_scalar_storage_order): Likewise.
> (init_pragma): Register scalar_storage_order.
> * c-pragma.h (maybe_apply_pragma_scalar_storage_order): Declare.
> * c.opt (Wscalar-storage-order): New warning.
> (fsso-struct=): New option.
> c/
> * c-decl.c (finish_struct): If the structure has reverse storage
> order, rewrite the type of array fields with scalar component. Call
> maybe_apply_pragma_scalar_storage_order on entry.
> * c-typeck.c (build_unary_op) <ADDR_EXPR>: Remove left-overs. Issue
> errors on bit-fields and reverse SSO here and not...
> (c_mark_addressable): ...here.
> (output_init_element): Adjust call to initializer_constant_valid_p.
> (c_build_qualified_type): Propagate TYPE_REVERSE_STORAGE_ORDER.
>
> doc/extend.texi | 69 ++++++++++++++++++++++++++++++++++++++++++--------
> doc/invoke.texi | 22 +++++++++++++++-
> flag-types.h | 9 +++++-
> c-family/c.opt | 17 ++++++++++++
> c-family/c-common.c | 47 ++++++++++++++++++++++++++++++++++-
> c-family/c-pragma.c | 50 +++++++++++++++++++++++++++++++++++++
> c-family/c-pragma.h | 1
> c/c-typeck.c | 66 ++++++++++++++++++++++++++++++++++---------------
> c/c-decl.c | 48 +++++++++++++++++++++++++-----------
> 8 files changed, 273 insertions(+), 47 deletions(-)
>
> -- Eric Botcazou
>
>
> sso-c.diff
>
>
> Index: doc/extend.texi
> ===================================================================
> --- doc/extend.texi (.../trunk/gcc) (revision 228112)
> +++ doc/extend.texi (.../branches/scalar-storage-order/gcc) (revision 228133)
> @@ -6310,6 +6310,42 @@ of the structure or union is placed to m
> +@itemize
> +@item Taking the address of a scalar field of a @code{union} or a
> +@code{struct} with reverse scalar storage order is not permitted and will
> +yield an error
Seems reasonable. Certainly avoids a host of problems tracking this
stuff later I bet.
> +static tree
> +handle_scalar_storage_order_attribute (tree *node, tree name, tree args,
> + int flags, bool *no_add_attrs)
> +{
> + tree id = TREE_VALUE (args);
> + tree type;
> +
> + if (TREE_CODE (*node) == TYPE_DECL
> + && ! (flags & ATTR_FLAG_CXX11))
> + node = &TREE_TYPE (*node);
> + type = *node;
> +
> + if (BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN)
> + error ("scalar_storage_order is not supported");
You might want to consider indicating why it's not supported. Not that
I expect folks to be using this on a pdp11 :-)
> Index: c/c-typeck.c
> ===================================================================
> --- c/c-typeck.c (.../trunk/gcc) (revision 228112)
> +++ c/c-typeck.c (.../branches/scalar-storage-order/gcc) (revision 228133)
> @@ -4173,18 +4173,10 @@ build_unary_op (location_t location,
> goto return_build_unary_op;
> }
>
> - /* For &x[y], return x+y */
> - if (TREE_CODE (arg) == ARRAY_REF)
> - {
> - tree op0 = TREE_OPERAND (arg, 0);
> - if (!c_mark_addressable (op0))
> - return error_mark_node;
> - }
Do we still get a proper diagnostic for &x[y] where x isn't something we
can mark addressable?
Our testsuites aren't particularly good (IMHO) at ensuring we're getting
diags in all the cases where they're required.
No real objections, assuming that &x[y] diagnostics is still handled
correctly somewhere.
next prev parent reply other threads:[~2015-10-13 11:32 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 10:57 [patch 0/6] scalar-storage-order merge (2) Eric Botcazou
2015-10-06 11:01 ` [patch 1/6] scalar-storage-order merge: Ada front-end Eric Botcazou
2015-10-12 22:23 ` Jeff Law
2015-10-06 11:02 ` [patch 2/6] scalar-storage-order merge: C front-end Eric Botcazou
2015-10-13 11:32 ` Jeff Law [this message]
2015-10-19 8:50 ` Eric Botcazou
2015-10-28 16:48 ` Joseph Myers
2015-10-28 17:32 ` Jeff Law
2015-10-28 22:34 ` Eric Botcazou
2015-10-28 23:36 ` Mike Stump
2015-10-29 0:23 ` Joseph Myers
2015-10-30 8:59 ` Eric Botcazou
2015-10-30 14:50 ` Mike Stump
2015-10-06 11:03 ` [patch 3/6] scalar-storage-order merge: C++ front-end Eric Botcazou
2015-10-12 22:27 ` Jeff Law
2015-10-06 11:05 ` [patch 4/6] scalar-storage-order merge: bulk Eric Botcazou
2015-10-13 16:07 ` Jeff Law
2015-10-20 16:35 ` Eric Botcazou
2015-10-06 11:06 ` [patch 5/6] scalar-storage-order merge: rest Eric Botcazou
2015-10-06 11:09 ` Eric Botcazou
2015-10-13 16:44 ` Jeff Law
2015-10-06 11:08 ` [patch 6/6] scalar-storage-order merge: testsuite Eric Botcazou
2015-10-12 22:26 ` Jeff Law
2015-10-09 11:33 ` [patch 0/6] scalar-storage-order merge (2) Bernd Schmidt
2015-10-13 17:33 ` Eric Botcazou
2015-10-14 15:25 ` Trevor Saunders
2015-10-14 15:33 ` Jeff Law
2015-11-08 18:30 ` Eric Botcazou
-- strict thread matches above, loose matches on Subject: below --
2015-06-16 8:46 [patch 0/6] scalar-storage-order merge Eric Botcazou
2015-06-16 8:56 ` [patch 2/6] scalar-storage-order merge: C front-end Eric Botcazou
2015-06-16 9:07 ` Ramana Radhakrishnan
2015-06-16 9:11 ` Andrew Pinski
2015-06-18 19:16 ` Eric Botcazou
2015-06-16 11:39 ` Richard Sandiford
2015-06-18 19:17 ` Eric Botcazou
2015-06-16 21:25 ` Joseph Myers
2015-06-19 9:36 ` Eric Botcazou
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=561CEBB8.3030002@redhat.com \
--to=law@redhat.com \
--cc=ebotcazou@adacore.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).