Skip to content

[libc] Fix fexcept_t type to match canonical ABI and API #113666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

frobtech
Copy link
Contributor

In glibc and musl, fexcept_t is unsigned short int on x86 and
unsigned int on other machines that llvm-libc supports. Match
that ABI (only different from before on x86) and API (different
everywhere as it was previously signed).

In glibc and musl, fexcept_t is unsigned short int on x86 and
unsigned int on other machines that llvm-libc supports.  Match
that ABI (only different from before on x86) and API (different
everywhere as it was previously signed).
@frobtech frobtech requested a review from lntue October 25, 2024 09:41
@frobtech frobtech marked this pull request as ready for review October 25, 2024 09:42
@llvmbot llvmbot added the libc label Oct 25, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 25, 2024

@llvm/pr-subscribers-libc

Author: Roland McGrath (frobtech)

Changes

In glibc and musl, fexcept_t is unsigned short int on x86 and
unsigned int on other machines that llvm-libc supports. Match
that ABI (only different from before on x86) and API (different
everywhere as it was previously signed).


Full diff: https://github.com/llvm/llvm-project/pull/113666.diff

1 Files Affected:

  • (modified) libc/include/llvm-libc-types/fexcept_t.h (+5-1)
diff --git a/libc/include/llvm-libc-types/fexcept_t.h b/libc/include/llvm-libc-types/fexcept_t.h
index 60687bd1318aa4..5aa09fbbaffc77 100644
--- a/libc/include/llvm-libc-types/fexcept_t.h
+++ b/libc/include/llvm-libc-types/fexcept_t.h
@@ -9,6 +9,10 @@
 #ifndef LLVM_LIBC_TYPES_FEXCEPT_T_H
 #define LLVM_LIBC_TYPES_FEXCEPT_T_H
 
-typedef int fexcept_t;
+#if defined(__x86_64__) || defined(__i386__)
+typedef unsigned short int fexcept_t;
+#else
+typedef unsigned int fexcept_t;
+#endif
 
 #endif // LLVM_LIBC_TYPES_FEXCEPT_T_H

@frobtech frobtech merged commit 0c8e12f into llvm:main Oct 30, 2024
23 checks passed
@frobtech frobtech deleted the p/libc-fexcept_t branch October 30, 2024 17:09
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
In glibc and musl, fexcept_t is unsigned short int on x86 and
unsigned int on other machines that llvm-libc supports.  Match
that ABI (only different from before on x86) and API (different
everywhere as it was previously signed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants