diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:33:54 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:36:09 +0900 |
commit | d9ec475d945d3035377a0d89ed42e382d8988891 (patch) | |
tree | 34aff2cee4b209906243ab5499d61f3edee2982f /libs/uuid | |
parent | 71d216b90256936a9638f325af9bc69d720e75de (diff) | |
download | boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.gz boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.bz2 boost-d9ec475d945d3035377a0d89ed42e382d8988891.zip |
Imported Upstream version 1.60.0
Change-Id: Ie709530d6d5841088ceaba025cbe175a4ef43050
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'libs/uuid')
-rw-r--r-- | libs/uuid/test/Jamfile.v2 | 5 | ||||
-rw-r--r-- | libs/uuid/test/test_msvc_simd_bug981648.hpp | 34 | ||||
-rw-r--r-- | libs/uuid/test/test_msvc_simd_bug981648_foo.cpp | 31 | ||||
-rw-r--r-- | libs/uuid/test/test_msvc_simd_bug981648_main.cpp | 40 |
4 files changed, 109 insertions, 1 deletions
diff --git a/libs/uuid/test/Jamfile.v2 b/libs/uuid/test/Jamfile.v2 index cba5321579..a6ff3a65b0 100644 --- a/libs/uuid/test/Jamfile.v2 +++ b/libs/uuid/test/Jamfile.v2 @@ -54,5 +54,8 @@ test-suite uuid : # test sha1 hash function [ run test_sha1.cpp ] + + # test MSVC 12 (VS2013) optimizer bug with SIMD operations. See https://svn.boost.org/trac/boost/ticket/8509#comment:3. + # Only happens in Release x64 builds. + [ run test_msvc_simd_bug981648_main.cpp test_msvc_simd_bug981648_foo.cpp : : : <variant>release <debug-symbols>on : test_msvc_simd_bug981648 ] ; - diff --git a/libs/uuid/test/test_msvc_simd_bug981648.hpp b/libs/uuid/test/test_msvc_simd_bug981648.hpp new file mode 100644 index 0000000000..f81e08e76f --- /dev/null +++ b/libs/uuid/test/test_msvc_simd_bug981648.hpp @@ -0,0 +1,34 @@ +/* +* Copyright 2014 Andrey Semashev +* +* Distributed under the Boost Software License, Version 1.0. +* See accompanying file LICENSE_1_0.txt or copy at +* http://www.boost.org/LICENSE_1_0.txt +*/ +/* +* This is a part of the test for a workaround for MSVC 12 (VS2013) optimizer bug +* which causes incorrect SIMD code generation for operator==. See: +* +* https://svn.boost.org/trac/boost/ticket/8509#comment:3 +* https://connect.microsoft.com/VisualStudio/feedbackdetail/view/981648#tabs +* +* The header contains common definitions for the two source files. +*/ +#include <boost/uuid/uuid.hpp> +using boost::uuids::uuid; +class headerProperty +{ +public: +virtual ~headerProperty() {} +}; +class my_obj: +public headerProperty +{ +public: +// This char tmp[8] forces the following uuid to be misaligned. +char tmp[8]; +// This m_uuid is misaligned (not 16-byte aligned) and causes the != operator to crash. +uuid m_uuid; +const uuid &get_marker_id() const { return m_uuid; } +uuid get_id() const { return m_uuid; } +}; diff --git a/libs/uuid/test/test_msvc_simd_bug981648_foo.cpp b/libs/uuid/test/test_msvc_simd_bug981648_foo.cpp new file mode 100644 index 0000000000..5e2cc79f1c --- /dev/null +++ b/libs/uuid/test/test_msvc_simd_bug981648_foo.cpp @@ -0,0 +1,31 @@ +/* +* Copyright 2014 Andrey Semashev +* +* Distributed under the Boost Software License, Version 1.0. +* See accompanying file LICENSE_1_0.txt or copy at +* http://www.boost.org/LICENSE_1_0.txt +*/ +/* +* This is a part of the test for a workaround for MSVC 12 (VS2013) optimizer bug +* which causes incorrect SIMD code generation for operator==. See: +* +* https://svn.boost.org/trac/boost/ticket/8509#comment:3 +* https://connect.microsoft.com/VisualStudio/feedbackdetail/view/981648#tabs +* +* The file contains the function that actually causes the crash. Reproduces only +* in Release x64 builds. +*/ +#include <cstdio> +#include "test_msvc_simd_bug981648.hpp" +void mp_grid_update_marker_parameters(headerProperty* header_prop, my_obj ¤t_marker) +{ +headerProperty *old_header_prop = NULL; +my_obj *p = dynamic_cast<my_obj*>(header_prop); +/* +* This != statement crashes with a GP. +* */ +if (p != NULL && (current_marker.get_id() != p->get_marker_id())) { +std::printf("works okay, if it reaches this printf: %p\n",p); +old_header_prop = header_prop; +} +} diff --git a/libs/uuid/test/test_msvc_simd_bug981648_main.cpp b/libs/uuid/test/test_msvc_simd_bug981648_main.cpp new file mode 100644 index 0000000000..35d3a11139 --- /dev/null +++ b/libs/uuid/test/test_msvc_simd_bug981648_main.cpp @@ -0,0 +1,40 @@ +/* +* Copyright 2014 Andrey Semashev +* +* Distributed under the Boost Software License, Version 1.0. +* See accompanying file LICENSE_1_0.txt or copy at +* http://www.boost.org/LICENSE_1_0.txt +*/ +/* +* This is a part of the test for a workaround for MSVC 12 (VS2013) optimizer bug +* which causes incorrect SIMD code generation for operator==. See: +* +* https://svn.boost.org/trac/boost/ticket/8509#comment:3 +* https://connect.microsoft.com/VisualStudio/feedbackdetail/view/981648#tabs +* +* This file contains the main entry point. +*/ +#include <cstdio> +#include "test_msvc_simd_bug981648.hpp" +extern void mp_grid_update_marker_parameters(headerProperty* header_prop, my_obj ¤t_marker); +static my_obj g_my_obj; +int main(int argc, char* argv[]) +{ +my_obj *p = &g_my_obj; +p->m_uuid = uuid(); +uuid one, two; +one.data[0] = 0; two.data[0] = 1; +//***************************************** +// This != statement generates two movdqu statements or pcmpeqd with a memory operand which crashes +if (one != two) { +std::printf("The first != operator works okay if it reaches this printf.\n"); +} +my_obj a; +a.m_uuid.data[0] = 1; +std::printf("There should be a another printf coming next.\n"); +//***************************************** +// The != statement in this function generates a movups and a movdqu statement. +// It also crashes because the optimizer also creates a pcmpeqd for a non-aligned memory location. +mp_grid_update_marker_parameters(p, a); +return 0; +}
\ No newline at end of file |