Commit Graph

3191 Commits

Author SHA1 Message Date
Arnamoy Bhattacharyya a40b609958 [flang][OpenMP] Add semantic check for occurrence of constructs nested inside a SIMD region
Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D99757
2021-05-06 15:09:51 -04:00
peter klausler 6a1c3efa05 [flang] Implement NAMELIST I/O in the runtime
Add InputNamelist and OutputNamelist as I/O data transfer APIs
to be used with internal & external list-directed I/O; delete the
needless original namelist-specific Begin... calls.
Implement NAMELIST output and input; add basic tests.

Differential Revision: https://reviews.llvm.org/D101931
2021-05-06 11:18:36 -07:00
peter klausler 4f41994c13 [flang] Fix race condition in runtime
The code that initializes the default units 5 & 6 had
a race condition that would allow threads access to the
unit map before it had been populated.

Also add some missing calls to va_end() that will never
be called (they're in program abort situations) but might
elicit warnings if absent.

Differential Revision: https://reviews.llvm.org/D101928
2021-05-06 11:09:30 -07:00
peter klausler 199a623ebf [flang] Runtime must defer formatted/unformatted determination
What the Fortran standard calls "preconnected" external I/O units
might not be known to be connected to unformatted or formatted files
until the first I/O data transfer statement is executed.
Support this deferred determination by representing the flag as
a tri-state Boolean and adapting its points of use.

Differential Revision: https://reviews.llvm.org/D101929
2021-05-06 11:06:43 -07:00
Andrzej Warzynski 65cd0d6be4 [flang] Remove `%f18` from LIT configuration files
`%f18` was originally introduced to represent the old Flang driver,
`f18`. With the introduction of the new driver, `flang-new`, we have
been switching to `%flang` (compiler driver) and `%flang_fc1` (frontend
driver) as more generic alternatives.

As most tests have been portend to use the new LIT variables instead of
`%f18`, this is good time to remove it from lit.cfg.py. There's only one
test left that requires the old driver to run. It's updated with:
```
! REQUIRES: old-flang-driver
```
This way we preserve its semantics while reducing the number of
variables in LIT configuration.

Differential Revision: https://reviews.llvm.org/D101281
2021-05-06 08:42:25 +00:00
peter klausler 535cbe02a4 [flang] Provide access to constant character array data
Allow direct access to constant character array data (for creating a hash ID of a constant).

Differential Revision: https://reviews.llvm.org/D101208
2021-05-05 16:56:00 -07:00
Nick Desaulniers aefbfbcbd7 [Clang] remove text extension from diag::err_drv_invalid_value_with_suggestion
This hinders translations, as per:
https://clang.llvm.org/docs/InternalsManual.html#the-format-string

Reviewed By: MaskRay, xbolva00

Differential Revision: https://reviews.llvm.org/D101387
2021-05-05 11:01:43 -07:00
Diana Picus 5112bd6b6e [flang] Fix a bug in the character runtime
The number of bytes copied in CopyAndPad should depend on the size of
the type being copied, not on its shift value (which in the case of char
is 0, leading to no bytes at all being copied).

Add unit tests for CharacterMin and CharacterMax, which exercise this
code path.

Differential Revision: https://reviews.llvm.org/D101355
2021-05-03 08:08:08 +00:00
Diana Picus aaab70407b [flang] Fix handling of elem_len in CFI_establish
The current code computes the minimum element length based on the `type`
used to create the descriptor and uses that as the element length
whenever it is greater than 0. This means that the `elem_len` parameter
is essentially ignored for any type where we can compute a minimum
element length (which includes `CFI_type_char[16|32]_t`), and we may
therefore end up with descriptors with a lower element length than
expected.

This patch fixes the issue by explicitly doing what the standard says,
i.e. it uses the given `elem_len` for character types, `CFI_type_struct`
and `CFI_type_other`, and ignores it (falls back to the minimum element
length) for everything else.

Differential Revision: https://reviews.llvm.org/D101659
2021-05-03 08:08:07 +00:00
Diana Picus 32f901bdf9 [flang] Use CFI_TYPE_LAST instead of CFI_type_struct
It looks like CFI_type_struct was once used as the last valid CFI_type
value, but in the meantime CFI_type_char16_t and CFI_type_char32_t were
added, making that assumption no longer true. Luckily, in the meantime
we also got a define for CFI_TYPE_LAST, which we can now use to allow
CFI_establish and CFI_allocate to work with descriptors of
CFI_type_char16_t, CFI_type_char32_t and any other future types.

Differential Revision: https://reviews.llvm.org/D101658
2021-05-03 08:08:07 +00:00
Peter Steinfeld 8989268dae [flang] Allow KIND type parameters to be used as LEN parameters of components
When producing the runtime type information for a component of a derived type
that had a LEN type parameter, we were not allowing a KIND parameter of the
derived type.  This was causing one of the NAG correctness tests to fail
(.../hibiya/d5.f90).

I added a test to our own test suite to check for this.

Also, I fixed a typo in .../module/__fortran_type_info.f90.

I allowed KIND type parameters to be used for the declarations of components
that use LEN parameters by constant folding the value of the LEN parameter.  To
make the constant folding work, I had to put the semantics::DerivedTypeSpec of
the associated derived type into the folding context.  To get this
semantics::DerivedTypeSpec, I changed the value of the semantics::Scope object
that was passed to DescribeComponent() to be the derived type scope rather than
the containing non-derived type scope.

This scope change, in turn, caused differences in the symbol table output that
is checked in typeinfo01.f90.  Most of these differences were in the order that
the symbols appeared in the dump.  But one of them changed one of the values
from "CHARACTER(2_8,1)" to "CHARACTER(1_8,1)".  I'm not sure if these changes
are significant.  Please verify that the results of this test are still valid.

Also, I wonder if there are other situations in this code where we should be
folding constants.  For example, what if the field of a component has a
component whose type is a PDT with a LEN type parameter, and the component's
declaration depends on the KIND type parameter of the current PDT.  Here's an
example:

  type string(stringkind)
    integer,kind :: stringkind
    character(stringkind) :: value
  end type string

  type outer(kindparam)
    integer,kind :: kindparam
    type(string(kindparam)) :: field
  end type outer

I don't understand the code or what it's trying to accomplish well enough to
figure out if such cases are correctly handled by my new code.

Differential Revision: https://reviews.llvm.org/D101482
2021-04-30 09:05:05 -07:00
Arnamoy Bhattacharyya 8f5a2a5836 [flang][OpenMP][FIX] Fix the worksharing nesting check with inclusion of more constructs to cover combined constructs. 2021-04-29 16:17:32 -04:00
Arnamoy Bhattacharyya 79f7d3b7b1 [flang][OpenMP] Add semantic checks for strict nesting inside `teams` construct. 2021-04-29 08:35:20 -04:00
Diana Picus a58f362fb5 [flang] Remove interfaces for Character[Min|Max][Val|Loc]. NFC
MAXVAL, MINVAL, MAXLOC and MINLOC are already implemented in extrema.cpp
as MaxvalCharacter, MinvalDim etc. Therefore, the interfaces in
character.h are redundant and should be removed to avoid confusion.

Differential Revision: https://reviews.llvm.org/D101354
2021-04-28 07:58:06 +00:00
Peter Steinfeld 8b550af7a9 [flang] Handle structure constructors with forward references to PDTs
We were not correctly handling structure constructors that had forward
references to parameterized derived types.  I harvested the code that checks
for forward references that was used during analysis of function call
expressions and called it from there and also called it during the
analysis of structure constructors.

I also added a test that will produce an internal error without this change.

Differential Revision: https://reviews.llvm.org/D101330
2021-04-27 12:46:05 -07:00
Asher Mancinelli 4abba775a3 [flang] Add format test to GTest suite
Reviewed by: awarzynski
Differential Revision: https://reviews.llvm.org/D100765
2021-04-27 07:45:18 -07:00
Peter Steinfeld f9c0859e96 [flang] Check for attributes specific to dummy arguments
We were not checking that attributes that are supposed to be specific to
dummy arguments were not being used for local entities.  I added the checks
along with tests for them.

After implementing these new checks, I found that one of the tests in
separate-mp02.f90 was erroneous, and I fixed it.

Differential Revision: https://reviews.llvm.org/D101126
2021-04-26 09:27:55 -07:00
Andrzej Warzynski 499f1ed548 [flang][driver] Fine-tune `-fdebug-dump-symbols`
When generating output for `-fdebug-dump-symbols`, make sure that
BuildRuntimeDerivedTypeTables is also run. This change is needed in
order to make the implementation of `-fdebug-dump-symbols` in
`flang-new` consistent with `f18`. It also allows us to port more tests
to use the new driver whenever it is enabled.

Differential Revision: https://reviews.llvm.org/D100649
2021-04-26 09:20:50 +00:00
peter klausler 0eb3299d28 [flang] Fix crash from -DMACRO= with empty replacement
Such macros were exposing some edge cases in the preprocessor
regarding empty tokens.

Differential Revision: https://reviews.llvm.org/D101207
2021-04-24 10:56:25 -07:00
Andrzej Warzynski 2f67267a93 [flang] Switch from %f18 to %flang_fc1 in a test
This patch updates the final test that can be shared between the old and
the new Flang drivers and that has not been ported yet. %f18 (always
expanded as `f18`) is replaced with %flang_fc1 (expanded as either `f18`
or `flang-new -fc1`, depending on `FLANG_BUILD_NEW_DRIVER`).

This test should've been updated in https://reviews.llvm.org/D100309,
but I missed it then. That's because this test contains non-ascii
characters and `grep -I %f18` (as well as other grep-like tools) skips
it because it's interpreted as a data/binary file. In fact, it's just a
text file with non-ascii chars.

Since this is an obvious omission from D100309 (reviewed, accepted and
merged), I'm sending this without a review to reduce the noise on
Phabricator.
2021-04-23 15:10:07 +00:00
peter klausler beb5ac8b25 [flang] (NFC) Break up flang/runtime/reduction.cpp
The single source file reduction.cpp is a little large in
terms of both source lines and generated text bytes, so
split SUM, PRODUCT, FINDLOC, and MAXLOC/MAXVAL/MINLOC/MINVAL
off into their own C++ source files that share a set of
implementation function templates now in a common header.

Differential Revision: https://reviews.llvm.org/D101111
2021-04-22 15:24:10 -07:00
peter klausler 47283e1556 [flang] (NFC) Document Fortran feature history
Add flang/docs/FortranFeatureHistory.md

Differential Revision: https://reviews.llvm.org/D101081
2021-04-22 11:24:22 -07:00
Andrzej Warzynski 43831d6279 [flang] Update recently added OpenMP tests to use the new driver
Switching from `%f18` to `%flang_fc1` in LIT tests added in
https://reviews.llvm.org/D91159. This way these tests are run with the
new driver, `flang-new`, when enabled (i.e. when
`FLANG_BUILD_NEW_DRIVER` is set).

Differential Revision: https://reviews.llvm.org/D101078
2021-04-22 17:23:32 +00:00
peter klausler 803f1e4653 [flang] Fix spurious errors from runtime derived type table construction
Andrezj W. @ Arm discovered that the runtime derived type table
building code in semantics was detecting fatal errors in the tests
that the f18 driver wasn't printing.  This patch fixes f18 so that
these messages are printed; however, the messages were not valid user
errors, and the rest of this patch fixes them up.

There were two sources of the bogus errors.  One was that the runtime
derived type information table builder was calculating the shapes of
allocatable and pointer array components in derived types, and then
complaining that they weren't constant or LEN parameter values, which
of course they couldn't be since they have to have deferred shapes
and those bounds were expressions like LBOUND(component,dim=1).

The second was that f18 was forwarding the actual LEN type parameter
expressions of a type instantiation too far into the uses of those
parameters in various expressions in the declarations of components;
when an actual LEN type parameter is not a constant value, it needs
to remain a "bare" type parameter inquiry so that it will be lowered
to a descriptor inquiry and acquire a captured expression value.

Fixing this up properly involved: moving some code into new utility
function templates in Evaluate/tools.h, tweaking the rewriting of
conversions in expression folding to elide needless integer kind
conversions of type parameter inquiries, making type parameter
inquiry folding *not* replace bare LEN type parameters with
non-constant actual parameter values, and cleaning up some
altered test results.

Differential Revision: https://reviews.llvm.org/D101001
2021-04-22 09:43:51 -07:00
Irina Dobrescu 123ae42566 [flang][openmp] Add General Semantic Checks for Allocate Directive
This patch adds semantic checks for the General Restrictions of the
Allocate Directive.

Since the requires directive is not yet implemented in Flang, the
restriction:
```
allocate directives that appear in a target region must
specify an allocator clause unless a requires directive with the
dynamic_allocators clause is present in the same compilation unit
```
will need to be updated at a later time.

A different patch will be made with the Fortran specific restrictions of
this directive.

I have used the code from https://reviews.llvm.org/D89395 for the
CheckObjectListStructure function.

Co-authored-by: Isaac Perry <isaac.perry@arm.com>

Reviewed By: clementval, kiranchandramohan

Differential Revision: https://reviews.llvm.org/D91159
2021-04-22 16:15:06 +00:00
Peter Steinfeld e9be1e7d84 [flang] Fix checking of argument passing for parameterized derived types
We were erroneously not taking into account the constant values of LEN type
parameters of parameterized derived types when checking for argument
compatibility.  The required checks are identical to those for assignment
compatibility.  Since argument compatibility is checked in .../lib/Evaluate and
assignment compatibility is checked in .../lib/Semantics, I moved the common
code into .../lib/Evaluate/tools.cpp and changed the assignment compatibility
checking code to call it.

After implementing these new checks, tests in resolve53.f90 were failing
because the tests were erroneous.  I fixed these tests and added new tests
to call03.f90 to test argument passing of parameterized derived types more
completely.

Differential Revision: https://reviews.llvm.org/D100989
2021-04-22 08:49:49 -07:00
Arnamoy Bhattacharyya 4299ab6c5d [flang][driver][Revert] Reverts f18 to allow options passed to -W
Reviewed By: awarzynski

Differential Revision: https://reviews.llvm.org/D100883
2021-04-22 11:47:48 -04:00
Mehdi Chinoune 0a7d2b5f50 [flang][msvc] Fix compilation of external-hello-world test with MSVC.
MSVC doesn't accept division by zero.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D96069
2021-04-21 15:18:24 -05:00
Nico Weber 861eff24df [flang] iwyu fixes after ba7a92c01e 2021-04-21 11:10:45 -04:00
Andrzej Warzynski dc256a443a [flang][driver] Add support for `-fget-definition`
This patch adds `-fget-definition` to `flang-new`. The semantics of this
option are identical in both drivers. The error message in the
"throwaway" driver is updated so that it matches the one from
`flang-new` (which is auto-generated and cannot be changed easily).

Tests are updated accordingly. A dedicated test for error handling was
added: get-definition.f90 (for the sake of simplicity,
getdefinition01.f90 no longer tests for errors).

The `ParseFrontendArgs` function is updated so that it can return
errors. This change is required in order to report invalid values
following `-fget-definition`.

The actual implementation of `GetDefinitionAction::ExecuteAction()` was
extracted from f18.cpp (i.e. the bit that deals with
`-fget-definition`).

Depends on: https://reviews.llvm.org/D100556

Differential Revision: https://reviews.llvm.org/D100558
2021-04-21 09:31:36 +00:00
Mehdi Chinoune 080d48f279 [flang][msvc] Fix compilation of RuntimeGtest
Removes alternate spelling 'not' with '!'.

Reviewed by: ashermancinelli, awarzynski, Meinersbur

Differential revision: https://reviews.llvm.org/D100442
2021-04-20 15:36:38 -06:00
Peter Steinfeld d667b96c98 [flang] Fix assignment of parameterized derived types
We were erroneously emitting error messages for assignments of derived types
where the associated objects were instantiated with non-constant LEN type
parameters.

I fixed this by adding the member function MightBeAssignmentCompatibleWith() to
the class DerivedTypeSpec and calling it to determine whether it's possible
that objects of parameterized derived types can be assigned to each other.  Its
implementation first compares the uninstantiated values of the types.  If they
are equal, it then compares the values of the constant instantiated type
parameters.

I added tests to assign04.f90 to exercise this new code.

Differential Revision: https://reviews.llvm.org/D100868
2021-04-20 12:41:52 -07:00
peter klausler 8d672c0b3e [flang] Implement IPARITY, PARITY, and FINDLOC reductions
Define APIs for, and implement, these three more recently-introduced
standard reduction transformational intrinsic functions to the runtime.

Differential Revision: https://reviews.llvm.org/D100863
2021-04-20 12:25:42 -07:00
Andrzej Warzynski 6d0fef4860 [flang][driver] Refactor methods for parsing options (nfc)
This is just a small update that makes sure that errors arising from
parsing command-line options are captured more visibly. Also, all
parsing methods will now consistently return either a bool ("may fail")
or void ("never fails").

An instance of `InputKind` coming from `-x` is added to
`FrontendOptions` rather then being returned from `ParseFrontendArgs`.
It's currently not used, but we will require it shortly. In particular,
once code-generation is available we will use it to differentiate
between LLVM IR and Fortran input. `FrontendOptions` is a very suitable
place to keep it.

This changes don't affect the error reporting in the driver. In this
respect these are non-functional-changes. However, it will simplify
things in the forthcoming patches in which we may need a better error
tracking/recovery mechanism.

Differential Revision: https://reviews.llvm.org/D100556
2021-04-20 14:00:45 +00:00
Andrzej Warzynski c2e452fb05 [flang][nfc] Port 2 tests to use the new driver when enabled
This is similar to https://reviews.llvm.org/D100309, i.e. `%f18` is
replaced with `%flang_new`.

resolve105.f90 wasn't in tree when D100309 was worked on, so it's
updated here instead.

label14.f90 requires `-fsyntax-only`. I didn't notice that when
submitting D100309, hence updating it now instead. `-fsyntax-only` is
required to prevent `%f18` from calling an external compiler (which then
fails and returns a non-zero exit code).

Differential Revision: https://reviews.llvm.org/D100655
2021-04-20 12:49:47 +00:00
peter klausler 71d868cf90 [flang] Define missing & needed IEEE_ARITHMETIC symbols
Define IEEE_IS_NAN, IEEE_IS_FINITE, & IEEE_REM.

Differential Revision: https://reviews.llvm.org/D100599
2021-04-19 11:44:43 -07:00
Sourabh Singh Tomar 5064a34165 [flang][OpenMP] Remove `OmpEndLoopDirective` handles from code.
This directive is currently lowered as NOP.

Patch is an attempt upstream code from:
PR: https://github.com/flang-compiler/f18-llvm-project/pull/573

Reviewed By: kiranchandramohan, schweitz, clementval

Differential Revision: https://reviews.llvm.org/D100576
2021-04-16 00:00:07 +05:30
Asher Mancinelli ccef0adc59 [flang] Add list input test to GTest suite 2021-04-15 09:27:43 -07:00
Andrzej Warzynski e7be90bd27 [flang] Update the regression tests to use the new driver when enabled
This patch updates most of the remaining regression tests (~400) to use
`flang-new` rather then `f18` when `FLANG_BUILD_NEW_DRIVER` is set.
This allows us to share more Flang regression tests between `f18` and
`flang-new`. A handful of tests have not been ported yet - these are
currently either failing or not supported by the new driver.

Summary of changes:
  * RUN lines in tests are updated to use `%flang_fc1` instead of `%f18`
  * option spellings in tests are updated to forms accepted by both `f18` and
    `flang-new`
  * variables in Bash scripts are renamed (e.g. F18 --> FLANG_FC1)
The updated tests will now be run with the new driver, `flang-new`,
whenever it is enabled (i.e when `FLANG_BUILD_NEW_DRIVER` is set).

Although this patch touches many files, vast majority of the changes are
automatic:
```
grep -IEZlr "%f18" flang/test/ | xargs -0 -l sed -i 's/%f18/%flang_fc1/g
```

Differential Revision: https://reviews.llvm.org/D100309
2021-04-15 08:52:23 +00:00
peter klausler e51939eca6 [flang] Fix typo caught by clang build
An inadvertent ! operator was (fortunately) flagged as a
warning by clang; remove it.

Differential Review: https://reviews.llvm.org/D100513
2021-04-14 15:10:40 -07:00
peter klausler cfc12a2120 [flang] Correct the interpretation of BIND(C,NAME='')
An empty NAME= should mean that there is no C binding, not the
binding that would result from BIND(C) without a NAME=.
See 18.10.2p2.

Differential Revision: https://reviews.llvm.org/D100494
2021-04-14 11:33:31 -07:00
peter klausler 17e2f236f0 [flang] Fix Boolean flag arguments
Two sites in io-api.cpp pass the wrong Boolean flag value to
signify that a new anonymous unit is a formatted file.

Differential Revision: https://reviews.llvm.org/D100419
2021-04-14 10:19:44 -07:00
peter klausler e81c96d6f8 [flang] Handle END= situations better in runtime input
Debug the input path for READ statements with END= labels;
don't emit errors when the program can handle them.
BeginReadingRecord() member functions have been made
"bool" for more convenient handling of error cases,
and some code in IoErrorHandler has been cleaned up.

Differential Revision: https://reviews.llvm.org/D100421
2021-04-14 09:34:14 -07:00
peter klausler f4ecd5a128 [flang] More precise enforcement of runtime constraint
An OPEN statement that affects an already connected unit
without changing its external file is required to have
STATUS="OLD" or default STATUS=.  The code was eliciting
spurious runtime errors in situations where an OPEN statement
pertained to an existing unit number but did not need to have
STATUS="OLD'.

Differential Revision: https://reviews.llvm.org/D100352
2021-04-13 16:00:32 -07:00
Arnamoy Bhattacharyya 162b463d85 [flang][OpenMP] Modify semantic check for nesting of `ordered` regions to include `close` nesting check.
Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D100222
2021-04-13 13:59:18 -04:00
Peter Steinfeld bef63dc88a [flang] Handle instantiation of procedure pointer components
We were not instantiating procedure pointer components.  If the instantiation
contained errors, we were not reporting them.  This resulted in internal errors
in later processing.

I fixed this by adding code in .../lib/Semantics/type.cpp in
InstantiateComponent() to handle a component with ProcEntityDetails.  I also
added several tests for various good and bad instantiations of procedure
pointer components.

Differential Revision: https://reviews.llvm.org/D100341
2021-04-13 10:55:49 -07:00
Andrzej Warzynski 808a5a2534 [flang][driver] Remove `%flang-new` from the LIT configuration
`%flang-new` was introduced in the early days of the new driver to make
a clear distinction between the tests for the current and the new
driver. We have since introduced `%flang` (compiler driver) and
`%flang_fc1` (frontend driver) as the long term solution. This has allowed
us to share tests between `flang-new` and `f18`. This patch replaces
all uses of `%flang-new` with `%flang` and `%flang_fc1`.

Some tests are reformatted so that all tests look uniform and are easier
to follow. Where possible, `! REQUIRES: new-flang-driver` is deleted so
that more tests can be shared with `f18`. To facilitate this,
`f{no-}implicit-none` are introduced in `f18` with semantics identical
to `flang-new`.

Two tests are deleted rather than updated:
  * flang/test/Frontend/print-preprocess-C-file.f90
  * flang/test/Frontend/print-preprocessed-file.f90
Instead, there is plenty of preprocessor tests in
flang/test/Preprocessing/.

Differential Revision: https://reviews.llvm.org/D100174
2021-04-13 10:55:01 +00:00
Andrzej Warzynski 4217e6bf95 [flang] Fix a test (use %s instead of $s)
With the typo ($S instead of %s), the driver was expecting
input from stdin. In such cases, it prints:
```
Enter Fortran source
Use EOF character (^D) to end file
```
This was piped to FileCheck. Together with the available `CHECK-NOT`
statement, this was sufficient for the test to pass (incorrectly).

This patch makes sure that the provided input file is used instead of
stdin.

Differential Revision: https://reviews.llvm.org/D100301
2021-04-13 10:03:07 +00:00
peter klausler 5fe83b048a [flang] Correct TypeCode::IsLogical()
F18 is using the type codes for C's "least" int types to encode
the various kinds of Fortran's LOGICAL intrinsic type; update
the IsLogical() predicate accordingly.  (This member function
isn't yet used anywhere, so this patch is nearly an NFC.)

Differential Revision: https://reviews.llvm.org/D100323
2021-04-12 12:57:22 -07:00
Tim Keith 50386fe1db [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
2021-04-12 09:40:52 -07:00