Changes

Summary

  1. [flang][runtime] Don't let random seed queries change the sequence (details)
  2. [flang][runtime] Don't crash after surviving internal output overflow (details)
  3. [flang] Don't crash on initialization with a zero-sized derived type (details)
  4. [flang][runtime] Fix edge case discrepancies with EN output editing (details)
  5. [flang][runtime] Fix WRITE after OPEN(.., ACCESS="APPEND") (details)
  6. [flang] When folding FINDLOC, convert operands to a common type (details)
Commit ea1a69d66dc7fd08b4b82492869ff3d6ae815991 by pklausler
[flang][runtime] Don't let random seed queries change the sequence

When the current seed of the pseudo-random generator is queried
with CALL RANDOM_SEED(GET=n), that query should not change the
stream of pseudo-random numbers produced by CALL RANDOM_NUMBER().

Differential Revision: https://reviews.llvm.org/D127023
The file was modifiedflang/runtime/random.cpp
Commit ea5b205bb89508613ee0a57ccbfd6924c4a9586b by pklausler
[flang][runtime] Don't crash after surviving internal output overflow

After the program has survived its attempt to overflow the output buffer
with an internal WRITE using ERR=, IOSTAT=, &/or IOMSG=, don't crash
by accidentally blank-filling the next record that usually doesn't exist.

Differential Revision: https://reviews.llvm.org/D127024
The file was modifiedflang/runtime/internal-unit.cpp
Commit d484fe93d4e827b4986b15f9db52099c925139b0 by pklausler
[flang] Don't crash on initialization with a zero-sized derived type

Avoid calls to memcpy with zero byte counts if their address argument
calculations may not be valid expressions.

Differential Revision: https://reviews.llvm.org/D127027
The file was modifiedflang/include/flang/Evaluate/initial-image.h
The file was modifiedflang/lib/Evaluate/initial-image.cpp
Commit dfcccc6dee90e08b9ae0f53c42c9c239fe4031a1 by pklausler
[flang][runtime] Fix edge case discrepancies with EN output editing

The "engineering" ENw.d output editing descriptor has some difficult
edge case behavior for values that might format into a bunch of 9's
or round up to a 1 for a given scale factor.  Fix the algorithm,
and add tests to protect against regressions.

Differential Revision: https://reviews.llvm.org/D127028
The file was modifiedflang/unittests/Runtime/NumericalFormatTest.cpp
The file was modifiedflang/runtime/edit-output.cpp
Commit 9a163ffe1a507c1f5a3d29b896224112d7e54f62 by pklausler
[flang][runtime] Fix WRITE after OPEN(.., ACCESS="APPEND")

The initial size of the file was not being captured as the file position
on which the first output buffer should be framed.

Differential Revision: https://reviews.llvm.org/D127029
The file was modifiedflang/runtime/file.cpp
The file was modifiedflang/runtime/unit.cpp
Commit ed71a0b45b6c927333fa2c91e16f75a251408691 by pklausler
[flang] When folding FINDLOC, convert operands to a common type

For example, FINDLOC(A,X) should convert both A and X to COMPLEX(8)
if the operands are REAL(8) and COMPLEX(4), so that comparisons
can be done without losing inforation.  The current implementation
unconditionally converts X to the type of the array A.

Differential Revision: https://reviews.llvm.org/D127030
The file was modifiedflang/lib/Evaluate/fold-integer.cpp
The file was modifiedflang/include/flang/Evaluate/type.h
The file was modifiedflang/lib/Evaluate/type.cpp