https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100920
Bug ID: 100920 Summary: bogus warn on -Wscalar-storage-order Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: george.thopas at gmail dot com Target Milestone: --- /* * trying to use -Wscalar-storage-order on latest git version * * https://gcc.gnu.org/g:401bd4adcfda9965363b1ac3ba7e1580f15d6883 * * below test exposes what looks like 2 wrong warnings * a warning on an union where everything is big-endian * a warning on type less void pointer * * gcc -Werror test.c * * Thanks */ include <stddef.h> struct s_1 { int val; } __attribute__((scalar_storage_order("big-endian"))); typedef struct s_1 t_1; struct s_2 { char val; } __attribute__((scalar_storage_order("big-endian"))); typedef struct s_2 t_2; struct s12 { t_1 a[1]; t_2 b[1]; } __attribute__((scalar_storage_order("big-endian"))); typedef struct s12 t_s12; /* Warning while everything is big-endian */ union u12 { t_1 a[1]; t_2 b[1]; } __attribute__((scalar_storage_order("big-endian"))); typedef union u12 t_u12; int main(void) { /* warning while assigning from a type less void pointer */ t_s12 *msg1 = __builtin_alloca(10); t_u12 *msg2 = __builtin_alloca(10); msg1->a[0].val=0; msg2->a[0].val=0; return 0;