[all-commits] [llvm/llvm-project] 50386f: [flang] Fix narrowing	warning on macos
    Tim Keith via All-commits 
    all-commits at lists.llvm.org
       
    Mon Apr 12 09:41:26 PDT 2021
    
    
  
  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 50386fe1db3ce57f762c9621b83445a4ffd80b26
      https://github.com/llvm/llvm-project/commit/50386fe1db3ce57f762c9621b83445a4ffd80b26
  Author: Tim Keith <tkeith at nvidia.com>
  Date:   2021-04-12 (Mon, 12 Apr 2021)
  Changed paths:
    M flang/runtime/random.cpp
  Log Message:
  -----------
  [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
    
    
More information about the All-commits
mailing list