[clang] [clang] improve consistency with GCC vector comparison (PR #148954)
Imple Lee via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 17 12:12:35 PDT 2025
ImpleLee wrote:
> > Compared to `int > signed char > short > long > long long`, inconsistency happens when `sizeof(int) == sizeof(short)`, which is true only in LP32 among [currently widely accepted data models](https://en.cppreference.com/w/cpp/language/types.html#Properties).
>
> Looks like GCC [uses the same order for `__attribute__((mode))`](https://gcc.gnu.org/cgit/gcc/tree/gcc/c-family/c-common.cc#n2447), so we get that attribute wrong in exactly the same way for LP32.
> Maybe we should add a `getGCCCompatibleIntTypeForBitwidth` that prefers `int` over everything else, and use it in both places?
_Originally posted by @zygoloid in [#132604](https://github.com/llvm/llvm-project/issues/132604#issuecomment-3084916138)_
I now prefer this proposal over the current PR. I will convert this PR into a draft PR when implementing it, and ask for review again after that.
https://github.com/llvm/llvm-project/pull/148954
More information about the cfe-commits
mailing list