public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Temporary step towards warning on unaligned capabilities
@ 2021-09-21  9:15 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-09-21  9:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b4ccf521cf49abfe4c993dbcdd0bf3c657c8c22f

commit b4ccf521cf49abfe4c993dbcdd0bf3c657c8c22f
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date:   Thu Sep 16 11:34:17 2021 +0100

    Temporary step towards warning on unaligned capabilities
    
    LLVM emits a warning for this.  This commit adds a warning, but does not
    set the correct warning message and warning group for it.
    
    Will fix that up later.

Diff:
---
 gcc/stor-layout.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 22cdd3ec565..8a16add9dbc 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -2383,6 +2383,16 @@ layout_type (tree type)
   if (TYPE_SIZE (type))
     return;
 
+  /* Ensure that any capability type warns if it is not aligned.
+     This should maybe get overridden in common_handle_aligned_attribute if the
+     user has provided their own request.
+     MORELLO TODO For capabilities we'll want to match the error message of
+     LLVM and have the relevant warning message under `-Wcheri-<whatever it
+     is>`.  With this temporary approach we at least have the warning.  */
+  if (CAPABILITY_MODE_P (TYPE_MODE (type)))
+    SET_TYPE_WARN_IF_NOT_ALIGN
+      (type, GET_MODE_BITSIZE (TYPE_MODE (type)).to_constant());
+
   switch (TREE_CODE (type))
     {
     case LANG_TYPE:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-21  9:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21  9:15 [gcc(refs/vendors/ARM/heads/morello)] Temporary step towards warning on unaligned capabilities Matthew Malcomson

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).