Repository navigation
Fix BSD-specific types on Linux for aarch64 - #329
Conversation
The recent addition of aarch64 fenv support uses BSD-specific types
(__uint64_t and __uint32_t) that are not defined on Linux systems,
causing compilation failures on aarch64-linux targets.
This commit replaces BSD-specific types with standard C99 types:
- __uint64_t → uint64_t
- __uint32_t → uint32_t
These standard types are available on all platforms through the
included <stdint.h> header.
Additionally, this fixes the initialization of __fe_dfl_env from
scalar 0 to {0} to match the typedef as a non-scalar type.
Fixes build failures on aarch64-linux-gnu and other non-BSD platforms.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #329 +/- ##
===========================================
+ Coverage 39.03% 72.09% +33.06%
===========================================
Files 233 233
Lines 6151 6139 -12
Branches 1608 1607 -1
===========================================
+ Hits 2401 4426 +2025
+ Misses 3397 1420 -1977
+ Partials 353 293 -60 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
(PR made by AI borrowing my account upon @ViralBShah's prompting) |
| * this as a default environment. | ||
| */ | ||
| const fenv_t __fe_dfl_env = 0; | ||
| const fenv_t __fe_dfl_env = {0}; |
There was a problem hiding this comment.
This is just a uint64_t, so what was here was originally ok.
There was a problem hiding this comment.
It's a struct on musl, which is what I think the AI was looking at: https://github.com/cloudius-systems/musl/blob/master/arch/arm/bits/fenv.h#L19-L21.
There was a problem hiding this comment.
According to https://en.cppreference.com/w/c/language/scalar_initialization.html, = {0} is valid for scalar initialization, so I think this fix is correct and will work for both libcs.
Problem
The recent addition of aarch64 fenv support in #319 (commit 1eeb139) introduced BSD-specific types (
__uint64_tand__uint32_t) that are not defined on Linux systems. This causes compilation failures on aarch64-linux targets.Solution
This PR replaces BSD-specific types with standard C99 types:
__uint64_t→uint64_t__uint32_t→uint32_tThese standard types are available on all platforms through the included
<stdint.h>header.Additionally, this fixes the initialization of
__fe_dfl_envfrom scalar0to{0}to match the typedef as a non-scalar type.Testing
Tested successfully with BinaryBuilder.jl on:
This resolves the build failures reported in JuliaPackaging/Yggdrasil#11347
Changes
__uint64_twithuint64_tininclude/openlibm_fenv_aarch64.h__uint32_twithuint32_tininclude/openlibm_fenv_aarch64.h__fe_dfl_envinaarch64/fenv.cfrom= 0to= {0}