[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YdTkUBSLCQv7++FN@gmail.com>
Date: Wed, 5 Jan 2022 01:20:32 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"David S. Miller" <davem@...emloft.net>,
Ard Biesheuvel <ardb@...nel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Jonathan Corbet <corbet@....net>, llvm@...ts.linux.dev
Subject: Re: [PATCH] headers/deps: dcache: Move the ____cacheline_aligned
attribute to the head of the definition
* Nathan Chancellor <nathan@...nel.org> wrote:
> Nowhere does it mention that it accepts the attribute before the type
> keyword and neither compiler respects the attribute if it comes before
> the keyword but at least clang warns: https://godbolt.org/z/E9fTecKPv
>
> $ cat test.c
> #include <stdio.h>
>
> struct foo {
> int a;
> int b;
> };
>
> struct __attribute__ ((aligned (64))) bar {
> int a;
> int b;
> };
>
> __attribute__ ((aligned (64))) struct baz {
> int a;
> int b;
> };
>
> int main(void)
> {
> printf("struct foo alignment: %zd\n", _Alignof(struct foo));
> printf("struct bar alignment: %zd\n", _Alignof(struct bar));
> printf("struct baz alignment: %zd\n", _Alignof(struct baz));
> return 0;
> }
>
> $ gcc --version | head -1
> gcc (GCC) 11.2.1 20211231
>
> $ gcc -std=gnu89 -Wall -Wextra test.c; and ./a.out
> struct foo alignment: 4
> struct bar alignment: 64
> struct baz alignment: 4
Ugh - so my changes there are outright buggy.
I'm reverting all those attribute position changes as we speak ...
I'm actually happy about this in a way, as it settles the issue nicely. :-)
Thanks,
Ingo
Powered by blists - more mailing lists