Page MenuHomePhabricator

[libcxx] Explicitly cast in generate_canonical
ClosedPublic

Authored by bcain on Aug 19 2019, 8:58 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

bcain created this revision.Aug 19 2019, 8:58 AM
bcain added a comment.Aug 19 2019, 2:15 PM

This patch is intended to address new warnings like the one below that shows up with clang on a hexagon target:

libcxx/include/random:3650:40: error: implicit conversion from 'unsigned long' to 'float' changes value from 2147483645 to 2147483648 [-Werror,-Wimplicit-int-float-conversion]
    const _RealType _Rp = _URNG::max() - _URNG::min() + _RealType(1);
                          ~~~~~~~~~~~~~^~~~~~~~~~~~~~ ~

I *think* the behavior is intended/expected, so that's why I include explicit casts here to avoid the implicit conversion warning.

The test case has corresponding warnings and I think I'll just include those in this commit here.

ldionne accepted this revision.Aug 20 2019, 8:35 AM

This looks right to me (and after a short discussion with Marshall it seemed alright to him too). I'm going to check it in to fix the several builders that are broken right now.

This revision is now accepted and ready to land.Aug 20 2019, 8:35 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2019, 8:38 AM