llvm-capstone/flang/lib/Evaluate
Jean Perier ec13942e71 [flang] prevent undefined behavior in character MAXLOC folding
When folding MAXLOC/MINLOC, the current element being compared was moved twice
in row in case it became the new extremum. With numeric and logical types, it
made no difference (std::move is a no-op for them), but for characters
where the string storage is actually moved, it caused the new extremum to
be set to the empty string, leading to wrong results.

Note: I could have left the first std::move relating to logical Findloc, but it
brings nothing and makes the code less auditable, so I also removed it.

Differential Revision: https://reviews.llvm.org/D122590
2022-03-29 09:34:09 +02:00
..
call.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
character.h [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
characteristics.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
check-expression.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
CMakeLists.txt [flang] Improve runtime interface with C99 complex 2021-10-01 08:45:24 +02:00
common.cpp [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
complex.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
constant.cpp [flang] LBOUND() edge case: empty dimension 2022-03-14 11:16:09 -07:00
expression.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
fold-character.cpp [flang] Fold SCALE() 2022-01-15 09:31:00 -08:00
fold-complex.cpp [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
fold-designator.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
fold-implementation.h Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
fold-integer.cpp [flang] prevent undefined behavior in character MAXLOC folding 2022-03-29 09:34:09 +02:00
fold-logical.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
fold-real.cpp [flang] Fold NEAREST() and its relatives 2022-03-28 11:33:40 -07:00
fold-reduction.cpp [flang] Fold FINDLOC() 2021-09-30 12:08:10 -07:00
fold-reduction.h [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
fold.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
formatting.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
host.cpp [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
host.h [flang] Fix/work around warnings from GCC 11 2022-02-01 11:54:04 -08:00
initial-image.cpp [flang] Allow DATA initialization of derived types w/ allocatable components 2022-02-14 10:43:49 -08:00
int-power.h [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
integer.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
intrinsics-library.cpp [flang] Support extension intrinsic function variations on ABS 2022-01-13 17:10:44 -08:00
intrinsics.cpp [flang] Accept legacy aliases for intrinsic function names 2022-03-18 16:53:13 -07:00
logical.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
real.cpp [flang] Fold NEAREST() and its relatives 2022-03-28 11:33:40 -07:00
shape.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
static-data.cpp [flang] Reformat with latest clang-format and .clang-format 2020-03-28 21:00:16 -07:00
tools.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
type.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00
variable.cpp Revert "[flang] Add & use a better visit()" 2022-03-28 10:46:47 +00:00