[compiler-rt] [compiler-rt] fix gcc 12 support by removing enum-type-specifier (PR #165034)
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 24 14:22:11 PDT 2025
compnerd wrote:
> > Thanks @yuxuanchen1997 for pointing out that using typed enums is c23, I missed that.
> > My goal with introducing the enum was to prevent errors like the one I fixed in the PR with CWF. I think we could keep the enum as an argument type, revert to unsigned int in the struct, and cast when calling the function. Would that be okay?
>
> Double checking this... You probably still have (some theoretical) ABI issues if the enums are used as arguments to `getIntelProcessorTypeAndSubtype` and `getAMDProcessorTypeAndSubtype`. Having pointers to signed enum as arguments, the two functions will do a signed to signed assignment by treating the argument pointer as one to a signed int, where the caller has passed one to an unsigned int. I think ideally you'd want to preserve that signed to unsigned assignment if you want to be able to pass `&(__cpu_model.__cpu_type)`.
Correct, but I the members of the structure is more what I was concerned about. The other functions should be fine (they shouldn't be used outside of the module).
https://github.com/llvm/llvm-project/pull/165034
More information about the llvm-commits
mailing list