Skip to content

llvm-libc: Fix -Wunsequenced volatile accesses in log1p.cpp - #28314

Merged
dschuff merged 1 commit into
emscripten-core:mainfrom
dschuff:fix-llvmlibc-unsequenced
Nov 18, 2026
Merged

dschuff merged 1 commit into
emscripten-core:mainfrom
dschuff:fix-llvmlibc-unsequenced

Conversation

@dschuff

@dschuff dschuff commented Nov 18, 2026

Copy link
Copy Markdown
Member

Recent Clang (llvm/llvm-project#180955) extended -Wunsequenced to diagnose multiple unsequenced accesses to volatile-qualified variables.

Backport the log1p fix from upstream llvm-project commit 5f47feeedda0 (preserving the 0x1p-24f constant for tn from this llvm-libc snapshot) by computing tp and tn into non-volatile temporaries before comparing.

Recent Clang (llvm/llvm-project#180955) extended -Wunsequenced to diagnose multiple unsequenced accesses to volatile-qualified variables.

Backport the log1p fix from upstream llvm-project commit 5f47feeedda0 (preserving the 0x1p-24f constant for tn from this llvm-libc snapshot) by computing tp and tn into non-volatile temporaries before comparing.
@dschuff
dschuff requested a review from aheejin November 18, 2026 21:36
@dschuff
dschuff enabled auto-merge (squash) November 18, 2026 21:36

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the rounding mode detection logic in system/lib/llvm-libc/src/math/generic/log1p.cpp by introducing volatile variables tpv and tnv for the initial float values, performing the subtraction into non-volatile float variables tp and tn, and then comparing them to detect the rounding direction. This ensures correct behavior and prevents potential compiler optimization issues with the previous inline volatile subtraction. There are no review comments, so we have no additional feedback to provide.

@dschuff
dschuff merged commit 7d83bee into emscripten-core:main Nov 18, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants