[flang] Fix narrowing warning on macos
authorTim Keith <tkeith@nvidia.com>
Mon, 12 Apr 2021 16:40:51 +0000 (09:40 -0700)
committerTim Keith <tkeith@nvidia.com>
Mon, 12 Apr 2021 16:40:52 +0000 (09:40 -0700)
commit50386fe1db3ce57f762c9621b83445a4ffd80b26
treef0ad6d2e005acc2cb80196a0d089054fbe30c3e2
parent38cf112a6bc8502ff8cce6ef524cf04c07f90f96
[flang] Fix narrowing warning on macos

With clang 11 on macos we were getting this warning:
```
flang/runtime/random.cpp:61:30: error: non-constant-expression cannot be narrowed from type 'unsigned long long' to 'runtime::GeneratedWord' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
          GeneratedWord word{(generator() - generator.min()) & rangeMask};
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flang/runtime/random.cpp:99:5: note: in instantiation of function template specialization 'runtime::Generate<double, 53>' requested here
    Generate<CppTypeFor<TypeCategory::Real, 8>, 53>(harvest);
    ^
```

Changing the type of `rangeMask` fixes it.

Differential Revision: https://reviews.llvm.org/D100320
flang/runtime/random.cpp