Changeset 938885d3


Ignore:
Timestamp:
May 6, 2021, 11:11:09 AM (3 years ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3e1a705, b721578
Parents:
8464edf
Message:

Fixing a false failure of the new array test on x86-32 -O3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/array-container/array-md-sbscr-cases.cfa

    r8464edf r938885d3  
    2727}
    2828
     29// Work around a compiler optimization that can lead to false failures.
     30// Think of `valExpected` as a constant local to each test function.
     31// When implemented that way, an optimization, run on some hardware, makes
     32// its value be off-by-a-little, compared with the values that have been
     33// stored-loaded (in the array under test).  This effect has been observed
     34// on x86-32 with -O3.  Declaring it as below forces the expected value
     35// to be stored-loaded too, which keeps the (admittedly lazily done)
     36// `assert(f1 == f2)` checks passing, when the intended <w,x,y,z> location
     37// is recovered, which is the point of all these tests.
     38volatile float valExpected = 0.0;
     39
    2940// Tests all the ways to split dimensions into CFA-supported chunks, by the only order that C supports: coarsest to finest stride.
    3041forall( [Nw], [Nx], [Ny], [Nz] )
     
    3647    ptrdiff_t iw = 2, ix = 3, iy=4, iz=5;
    3748
    38     const float valExpected = getMagicNumber(iw, ix, iy, iz);
    39     assert( wxyz[iw][ix][iy][iz] == valExpected );
     49    valExpected = getMagicNumber(iw, ix, iy, iz);
     50    float valGot = wxyz[iw][ix][iy][iz];
     51    assert( valGot == valExpected );
    4052
    4153    // order wxyz, natural split (4-0 or 0-4, no intermediate to declare)
     
    8698    ptrdiff_t iw = 2, ix = 3, iy=4, iz=5;
    8799
    88     const float valExpected = getMagicNumber(iw, ix, iy, iz);
     100    valExpected = getMagicNumber(iw, ix, iy, iz);
    89101    assert( wxyz[iw][ix][iy][iz] == valExpected );
    90102
     
    129141    ptrdiff_t iw = 2, ix = 3, iy=4, iz=5;
    130142
    131     const float valExpected = getMagicNumber(iw, ix, iy, iz);
     143    valExpected = getMagicNumber(iw, ix, iy, iz);
    132144    assert( wxyz[iw][ix][iy][iz] == valExpected );
    133145
     
    225237    fillHelloData(wxyz);
    226238
    227     const float valExpected = getMagicNumber(2, 3, 4, 5);
     239    valExpected = getMagicNumber(2, 3, 4, 5);
    228240    assert(( wxyz [2] [3] [4] [5]  == valExpected ));
    229241    assert(( wxyz[[2,  3]][4] [5]  == valExpected ));
Note: See TracChangeset for help on using the changeset viewer.