You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a test (see [1]) for vector and deque that calls erase_range(iterator, iterator) (empty range). This currently ends-up calling MOVE_ALLOC(X, X) (at [2] and [3]) which is not legal Fortran (see [4]).
While most compilers do not emit runtime errors, they silently deallocate X, which in the case of erase_range ends-up destroying the vector/deque elements after the iterator. I expect the intention for erase_range(iterator, iterator) is to be a no-op instead, the vector/deque code should probably do nothing in this case.
You can observe the issue if you add an ASSERT to test the element values (like ASSERT(v%at(2), two)) after the erase_range call in the test_erase_empty_range test.
gfortran builds will fail with:
[Test_deferred_stringVector.pf:851]
String assertion failed:
expected: <"">
but found: <"two">
first diff:
There is a test (see [1]) for vector and deque that calls
erase_range(iterator, iterator)
(empty range). This currently ends-up callingMOVE_ALLOC(X, X)
(at [2] and [3]) which is not legal Fortran (see [4]).While most compilers do not emit runtime errors, they silently deallocate X, which in the case of erase_range ends-up destroying the vector/deque elements after the iterator. I expect the intention for
erase_range(iterator, iterator)
is to be a no-op instead, the vector/deque code should probably do nothing in this case.You can observe the issue if you add an ASSERT to test the element values (like
ASSERT(v%at(2), two)
) after theerase_range
call in thetest_erase_empty_range
test.gfortran builds will fail with:
[1] :
gFTL/tests/vector/Test_Vector.m4
Line 409 in dc93a5f
[2]:
gFTL/include/v2/deque/procedures.inc
Line 743 in dc93a5f
[3]:
gFTL/include/v2/vector/procedures.inc
Line 777 in dc93a5f
[4]: Fortran 2018 section 16.9.137 point 4 mandates: "if FROM and TO are the same variable, it shall be unallocated when MOVE_ALLOC is invoked"
I found this issue because flang generate runtime errors for such MOVE_ALLOC.
The text was updated successfully, but these errors were encountered: