Issue 241658
Summary [Clang] GNU attributes before a global-scope asm declaration are silently ignored
Labels clang
Assignees
Reporter ChenMiaoi
    Clang accepts a GNU attribute before an asm declaration at global scope without a diagnostic, but rejects the same syntax inside a function.

Minimal reproducer ([Godbolt](https://godbolt.org/z/rEzT74s1K)):

``` cc
__attribute__((unused)) asm(""); // Accepted, no diagnostic

void f() {
  __attribute__((unused)) asm(""); // Error
}
```

On Clang trunk, only the version inside the function produces a diagnostic. Compiling the global declaration on its own also succeeds without any warning. For comparison, GCC 16.2 rejects both.

Is a diagnostic missing for the GNU attribute at global scope? I’d like to confirm the intended Clang behavior here. The difference between silently accepting and ignoring the attribute at global scope and rejecting it inside a function does not seem intentional.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to