This is an archive of the discontinued LLVM Phabricator instance.

[openmp] Fix enumeration build issue for openmp library
ClosedPublic

Authored by ronlieb on Aug 9 2022, 3:03 AM.

Details

Summary

integer value 40962 is outside the valid range of values [0, 31] for this enumeration type [-Wenum-constexpr-conversion]` (Issue #57022)

turn on -Wno-enum-constexpr-conversion to buy some time to fix the more egregious issue in hsa_agent_into_t and hsa_amd_agent_info_t interfaces.

relates to https://reviews.llvm.org/D131307/new/

Diff Detail

Event Timeline

ronlieb created this revision.Aug 9 2022, 3:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2022, 3:03 AM
ronlieb requested review of this revision.Aug 9 2022, 3:03 AM
JonChesterfield accepted this revision.Aug 9 2022, 3:23 AM

Sure. Have you tagged Sean on this to workaround in the lib? I don't see how an enum without specified type could be smaller than int, so that's either an edge in C++ I didn't notice or too aggressive behaviour from clang

This revision is now accepted and ready to land.Aug 9 2022, 3:23 AM

Ah. So C++ have decided writing a value outside the range of initial values is UB. C still thinks it's an int afaik. So that's a somewhat gratuitous break for shared headers. https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2338

Whatever, workaround is trivial. The enum needs to gain a field _unused_work_around_D2338 = INT32_MAX

This revision was automatically updated to reflect the committed changes.

In my new PR: https://reviews.llvm.org/D150226 in which I am planning on turning off the ability to turn the error into a warning this change was flagged.

According to one of the comments the workaround to this is trivial, can we remediate the issue so we can help unblock the PR.