Skip to content
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

Add casts to type conversion to fix long dbl bug #3038

Merged
merged 1 commit into from
Jun 3, 2023

Conversation

derobins
Copy link
Member

@derobins derobins commented Jun 3, 2023

If a user buffer is misaligned in the type conversion code, memcpy could fail if the call is SSE-optimized by the compiler. This change adds uint8_t * casts so the compiler won't make optimistic assumptions about buffer alignment.

If a user buffer is misaligned in the type conversion code, memcpy
could fail if the call is SSE-optimized by the compiler. This change
adds uint8_t * casts so the compiler won't make optimistic assumptions
about buffer alignment.
@derobins derobins added Merge - To 1.12 Priority - 1. High 🔼 These are important issues that should be resolved in the next release Component - C Library Core C library issues (usually in the src directory) Type - Bug / Bugfix Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub labels Jun 3, 2023
@derobins
Copy link
Member Author

derobins commented Jun 3, 2023

This only showed up in a different PR (#2382) where we replace the library re-implementation of memcpy with the one in the standard library, but in the past we've frequently had bugs with long doubles that were "fixed" by selecting lower optimization levels for that platform. In the case I tripped over, the problem only shows up at high optimization levels, where the compiler uses SSE to perform the memcpy (SSE buffers have to be aligned on 16 bytes).

@derobins derobins merged commit e3559c7 into HDFGroup:develop Jun 3, 2023
derobins added a commit to derobins/hdf5 that referenced this pull request Jun 6, 2023
* Bump GitHub action macOS version to 13 (HDFGroup#2999, HDFGroup#3009)
* Bump GitHub action gcc/g++/gfortran version to 12 (HDFGroup#3015)
* Bump Autoconf version to 2.71 (HDFGroup#2944)
* Fix missing h5_reset() calls in accum test (HDFGroup#3001)
* Only run ttsafe in GitHub thread-safe actions (HDFGroup#2777)
* Fix Java debug asserts on Windows (HDFGroup#3012)
* Fix long double dt_arith bug on macOS (HDFGroup#3038)
derobins added a commit that referenced this pull request Jun 6, 2023
* Bump GitHub action macOS version to 13 (#2999, #3009)
* Bump GitHub action gcc/g++/gfortran version to 12 (#3015)
* Bump Autoconf version to 2.71 (#2944)
* Fix missing h5_reset() calls in accum test (#3001)
* Only run ttsafe in GitHub thread-safe actions (#2777)
* Fix Java debug asserts on Windows (#3012)
* Fix long double dt_arith bug on macOS (#3038)
brtnfld pushed a commit to brtnfld/hdf5 that referenced this pull request Oct 5, 2023
* Bump GitHub action macOS version to 13 (HDFGroup#2999, HDFGroup#3009)
* Bump GitHub action gcc/g++/gfortran version to 12 (HDFGroup#3015)
* Bump Autoconf version to 2.71 (HDFGroup#2944)
* Fix missing h5_reset() calls in accum test (HDFGroup#3001)
* Only run ttsafe in GitHub thread-safe actions (HDFGroup#2777)
* Fix Java debug asserts on Windows (HDFGroup#3012)
* Fix long double dt_arith bug on macOS (HDFGroup#3038)
@derobins derobins deleted the fix_macos_long_double branch March 27, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues (usually in the src directory) Priority - 1. High 🔼 These are important issues that should be resolved in the next release Type - Bug / Bugfix Please report security issues to help@hdfgroup.org instead of creating an issue on GitHub
Projects
Status: Needs Merged
Development

Successfully merging this pull request may close these issues.

2 participants