• Jose Dapena Paz's avatar
    GCC: do not optimize destructors on VectorBuffer unit tests · 37cb5af3
    Jose Dapena Paz authored
    On GCC builds with optimizations 3 VectorBuffer unit tests are failing:
    DeleteMoveOnly, MovableMove and CopyableMove. This is because the tests
    assume the original VectorBuffer items destructor will be invoked.
    
    In the case of MoveOnlyInt and CopyOnlyInt, the destructor will set
    the member int to 0. On GCC, in the test cases, those count as storage
    after destruction, and optimized away by dead store elimination.
    
    But setting the int as volatile will avoid the code being optimized
    away, and fix the unit tests.
    
    Change-Id: Ibad460d4f75b91cbcbaf935c32a6b9f8d1fd186a
    Reviewed-on: https://chromium-review.googlesource.com/968844Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Commit-Queue: José Dapena Paz <jose.dapena@lge.com>
    Cr-Commit-Position: refs/heads/master@{#545097}
    37cb5af3
copy_only_int.h 1.42 KB