diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/c-typeck.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr114727.c | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index e486ac0..455dc37 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -1603,6 +1603,9 @@ tagged_types_tu_compatible_p (const_tree t1, const_tree t2, != TYPE_REVERSE_STORAGE_ORDER (t2))) return false; + if (TYPE_USER_ALIGN (t1) != TYPE_USER_ALIGN (t2)) + data->different_types_p = true; + /* For types already being looked at in some active invocation of this function, assume compatibility. The cache is built as a linked list on the stack diff --git a/gcc/testsuite/gcc.dg/pr114727.c b/gcc/testsuite/gcc.dg/pr114727.c new file mode 100644 index 0000000..1294959 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr114727.c @@ -0,0 +1,6 @@ +/* { dg-do compile } + * { dg-options "-std=c23 -g" } */ + +#define Y [[gnu::aligned(128)]] +extern struct Y foo { int x; } x; +struct foo { int x; }; /* { dg-error "redefinition" } */ |