Skip to content

Fix test_rounding for recent LLVM change#26975

Open
kripken wants to merge 3 commits into
emscripten-core:mainfrom
kripken:unblock.roll
Open

Fix test_rounding for recent LLVM change#26975
kripken wants to merge 3 commits into
emscripten-core:mainfrom
kripken:unblock.roll

Conversation

@kripken
Copy link
Copy Markdown
Member

@kripken kripken commented May 18, 2026

As of llvm/llvm-project@5f2bedc, LLVM warns on using fe* methods without proper flags.

This does not really matter in wasm, but we still must disable the warning.

@kripken kripken requested a review from dschuff May 18, 2026 20:10
Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Never heard to this pragma.. lgtm if works.

@kripken
Copy link
Copy Markdown
Member Author

kripken commented May 18, 2026

Yeah, I never heard of it either, but at least the LLVM warning is clear:

test_rounding.c:43:21: error: 'fegetround' used without enabling floating-point exception behavior; use 'pragma STDC FENV_ACCESS ON' or compile with '-ffp-exception-behavior=maytrap' [-Werror,-Wfenv-access]

Comment thread ChangeLog.md Outdated
e.g. Intel x64 Macs and Windows-on-ARM, downloading Java SE Development Kit
21.0.11 from https://www.oracle.com/europe/java/technologies/downloads/#java21
is required in order to use Emscripten's Closure Compiler integration.
- clang now warns if fp exception functions are called without appropriate
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's not just exception functions, I think it's anything from fenv.h (in our test it's fegetround).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Though, re-reading the LLVM commit, they do call these "fp exception functions"?

@kripken
Copy link
Copy Markdown
Member Author

kripken commented May 18, 2026

Landing to unblock the roller, we can iterate on the text later if we want.

@kripken
Copy link
Copy Markdown
Member Author

kripken commented May 18, 2026

Oh, this pragma fails on this target actually... I'll disable the warning then. That also makes the changlog moot (users have just one choice here).

@kripken
Copy link
Copy Markdown
Member Author

kripken commented May 18, 2026

Ah, that doesn't work too, because the warning doesn't exist...

I'll disable this not-very-important test to allow the roll, then fix.

Comment thread test/test_core.py Outdated
self.do_run_in_out_file_test('math/fmodf.c')

def test_rounding(self):
self.skipTest('https://github.com/emscripten-core/emscripten/pull/26975')
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You can use -Wno-unknown-warning-option for this :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh nice, thanks. Done. Maybe some day I'll get this PR right...

@kripken
Copy link
Copy Markdown
Member Author

kripken commented May 18, 2026

lol the LLVM commit was just reverted, so this is not needed any more (but might be if it relands...)

@dschuff
Copy link
Copy Markdown
Member

dschuff commented May 18, 2026

You said we don't support this pragma on Wasm? I guess it sort of makes sense since it doesn't really work, but it seems like if we're going to have a no-op fenv.h we should have a noop pragma too.

@kripken
Copy link
Copy Markdown
Member Author

kripken commented May 18, 2026

Yes, the pragma just errors in clang on not being supported in the target. I agree it's not very consistent (though enough of a corner case that I'm not terribly worried...)

@dschuff
Copy link
Copy Markdown
Member

dschuff commented May 19, 2026

Yeah, according to the discussion on llvm/llvm-project#187860 the question of what to do on targets that don't support FENV_ACCESS is one of the current issues. Assuming wasm is currently recognized as that, then maybe we will fall into whatever solution they come up with (presumably just disabling the warning on those targets). Although having our "noop" fenv functions suggests that we could potentially also have a noop pragma and require it to be used. This would mean that if and when we get rounding modes in wasm and want to support them in Emscripten code that correctly uses the rounding modes we support would start working as intended.

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.

3 participants