llvm / llvm/llvm-project

[Clang] `gnu::aligned` attribute inconsistently removed during type un-qualification

Open
#175,733 2 comments 0 reactions 0 assignees View on GitHub
clang extension:gnu
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

https://godbolt.org/z/a1zjYMrY5
```c
[[gnu::aligned]] typedef int T1;
[[gnu::aligned]] typedef int const T2;
[[gnu::aligned]] typedef int volatile T3;

__typeof_unqual(T1) i1; // 16-bytes aligned
__typeof_unqual(T2) i2; // 4-bytes aligned
__typeof_unqual(T3) i3; // 4-bytes aligned
```
IMO this is rather inconsistent, however GCC also behaves like this.

Contributor guide

Open the contributing guide

Research direction

Start with the linked Godbolt reproducer and compare Clang's handling of __typeof_unqual for T1, T2, and T3, including the resulting alignment. The issue does not name a source file or test, and it leaves the intended consistent behavior unresolved; done would require an agreed behavior plus coverage demonstrating it.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.