]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | * Copyright 2014 Andrey Semashev | |
3 | * | |
4 | * Distributed under the Boost Software License, Version 1.0. | |
5 | * See accompanying file LICENSE_1_0.txt or copy at | |
6 | * http://www.boost.org/LICENSE_1_0.txt | |
7 | */ | |
8 | /* | |
9 | * This is a part of the test for a workaround for MSVC 12 (VS2013) optimizer bug | |
10 | * which causes incorrect SIMD code generation for operator==. See: | |
11 | * | |
12 | * https://svn.boost.org/trac/boost/ticket/8509#comment:3 | |
13 | * https://connect.microsoft.com/VisualStudio/feedbackdetail/view/981648#tabs | |
14 | * | |
15 | * This file contains the main entry point. | |
16 | */ | |
17 | #include <cstdio> | |
18 | #include "test_msvc_simd_bug981648.hpp" | |
19 | extern void mp_grid_update_marker_parameters(headerProperty* header_prop, my_obj ¤t_marker); | |
20 | static my_obj g_my_obj; | |
b32b8144 | 21 | int main(void) |
7c673cae FG |
22 | { |
23 | my_obj *p = &g_my_obj; | |
24 | p->m_uuid = uuid(); | |
25 | uuid one, two; | |
26 | one.data[0] = 0; two.data[0] = 1; | |
27 | //***************************************** | |
28 | // This != statement generates two movdqu statements or pcmpeqd with a memory operand which crashes | |
29 | if (one != two) { | |
30 | std::printf("The first != operator works okay if it reaches this printf.\n"); | |
31 | } | |
32 | my_obj a; | |
33 | a.m_uuid.data[0] = 1; | |
34 | std::printf("There should be a another printf coming next.\n"); | |
35 | //***************************************** | |
36 | // The != statement in this function generates a movups and a movdqu statement. | |
37 | // It also crashes because the optimizer also creates a pcmpeqd for a non-aligned memory location. | |
38 | mp_grid_update_marker_parameters(p, a); | |
39 | return 0; | |
b32b8144 | 40 | } |