All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] RFC disable GCC 9 -Waddress-of-packed-member
@ 2019-11-27 22:44 Stefano Stabellini
  2019-11-27 22:48 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Stefano Stabellini @ 2019-11-27 22:44 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, julien, wl, konrad.wilk, George.Dunlap,
	andrew.cooper3, ian.jackson, jbeulich

Hi all,

GCC 9 introduced a new warning: address-of-packed-member. It warns when
a pointer points to a member of a packed struct, leading to a build
failure in Xen (cross compiling Xen on Arm with GCC 9.2):

  556 trace.c: In function '__trace_hypercall':
  557 trace.c:826:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  558   826 |     uint32_t *a = d.args;

Looking at the code, I cannot see anything wrong with what we are doing.
At least on Arm, it looks OK? Anything I am missing?

If you can spot anything wrong with the Xen code, do let me know.
Otherwise, I am thinking of disabling the warning:


diff --git a/xen/Rules.mk b/xen/Rules.mk
index 5337e20..8d5c77c 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -86,6 +86,9 @@ CFLAGS += $(CFLAGS-y)
 # allow extra CFLAGS externally via EXTRA_CFLAGS_XEN_CORE
 CFLAGS += $(EXTRA_CFLAGS_XEN_CORE)
 
+# Disable GCC 9 warning about pointers to members of a packed struct
+CFLAGS += -Wno-address-of-packed-member
+
 # Most CFLAGS are safe for assembly files:
 #  -std=gnu{89,99} gets confused by #-prefixed end-of-line comments
 #  -flto makes no sense and annoys clang


Cheers,

Stefano

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] RFC disable GCC 9 -Waddress-of-packed-member
  2019-11-27 22:44 [Xen-devel] RFC disable GCC 9 -Waddress-of-packed-member Stefano Stabellini
@ 2019-11-27 22:48 ` Andrew Cooper
  2019-11-27 22:50   ` Stefano Stabellini
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2019-11-27 22:48 UTC (permalink / raw)
  To: Stefano Stabellini, xen-devel
  Cc: julien, wl, konrad.wilk, George.Dunlap, ian.jackson, jbeulich

On 27/11/2019 22:44, Stefano Stabellini wrote:
> Hi all,
>
> GCC 9 introduced a new warning: address-of-packed-member. It warns when
> a pointer points to a member of a packed struct, leading to a build
> failure in Xen (cross compiling Xen on Arm with GCC 9.2):
>
>   556 trace.c: In function '__trace_hypercall':
>   557 trace.c:826:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value
> [-Werror=address-of-packed-member]
>   558   826 |     uint32_t *a = d.args;
>
> Looking at the code, I cannot see anything wrong with what we are doing.
> At least on Arm, it looks OK? Anything I am missing?

c/s 3fd3b266d4 at a guess.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] RFC disable GCC 9 -Waddress-of-packed-member
  2019-11-27 22:48 ` Andrew Cooper
@ 2019-11-27 22:50   ` Stefano Stabellini
  0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2019-11-27 22:50 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Stefano Stabellini, julien, wl, konrad.wilk, George.Dunlap,
	ian.jackson, jbeulich, xen-devel

On Wed, 27 Nov 2019, Andrew Cooper wrote:
> On 27/11/2019 22:44, Stefano Stabellini wrote:
> > Hi all,
> >
> > GCC 9 introduced a new warning: address-of-packed-member. It warns when
> > a pointer points to a member of a packed struct, leading to a build
> > failure in Xen (cross compiling Xen on Arm with GCC 9.2):
> >
> >   556 trace.c: In function '__trace_hypercall':
> >   557 trace.c:826:19: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value
> > [-Werror=address-of-packed-member]
> >   558   826 |     uint32_t *a = d.args;
> >
> > Looking at the code, I cannot see anything wrong with what we are doing.
> > At least on Arm, it looks OK? Anything I am missing?
> 
> c/s 3fd3b266d4 at a guess.

Thank you! I missed it :-/

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-27 22:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 22:44 [Xen-devel] RFC disable GCC 9 -Waddress-of-packed-member Stefano Stabellini
2019-11-27 22:48 ` Andrew Cooper
2019-11-27 22:50   ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.