Runtime stack check routine failure with AVX

Reference Number : 
DPD200165944

Version : 
12.0

Product : 
Intel Composer XE

Operating System : 
Windows

Problem Description : 
In a specific code scenario, involving AVX code and compiler's runtime stack check routines, the compiler emits erroneous code which leads to a malfunction of the runtime stack check routine (_RTC_CheckStackVars). Finally, the executed program terminates prematurely.

A code example is given below and is commented in detail.

//tstcase2.cpp
#include <iostream>
#include "immintrin.h"
namespace
{
	const size_t BUFFERSIZE = 100;
	const size_t AVXBUFFERSIZE = 100;
}
void testfn()
{
	unsigned char buffer[BUFFERSIZE];
	__m256 avxBuffer[AVXBUFFERSIZE];

// #if 1 == bug, #if 0 == no bug
#if 1
	for (size_t i = 0; i < 3; ++i)
                avxBuffer[i] = _mm256_set1_ps(0.0f);
#else
                avxBuffer[0] = _mm256_set1_ps(0.0f);
                avxBuffer[1] = _mm256_set1_ps(0.0f);
                avxBuffer[2] = _mm256_set1_ps(0.0f);
#endif
}

int main(int argc, char* argv[])
{
	testfn();
       std::cout << "Program is correct." << std::endl;
	return 0;
}
The code should be compiled using the following instructions:

c:\I>icl /RTCs /GS /EHsc tstcase2.cpp
Intel® C++ Intel® 64 Compiler XE for applications running on Intel® 64, Version 12.0.1.127 Build 20101116
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.

tstcase2.cpp
Microsoft ® Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

-out:tstcase2.exe
tstcase2.obj
c:\>tstcase2.exe

The test case will print "Program is correct" if no issue.

The fail doesn't happen if the loop is unrolled.

The fail doesn't happen if the __ms256 type is replaced with __m128 and an SSE intrinsic is used to initialize it.


Resolution Status : 

The issue is resolved in Intel composer XE 12.0 update 2.


[DISCLAIMER: The information on this web site is intended for hardware system manufacturers and software developers. Intel does not warrant the accuracy, completeness or utility of any information on this site. Intel may make changes to the information or the site at any time without notice. Intel makes no commitment to update the information at this site. ALL INFORMATION PROVIDED ON THIS WEBSITE IS PROVIDED "as is" without any express, implied, or statutory warranty of any kind including but not limited to warranties of merchantability, non-infringement of intellectual property, or fitness for any particular purpose. Independent companies manufacture the third-party products that are mentioned on this site. Intel is not responsible for the quality or performance of third-party products and makes no representation or warranty regarding such products. The third-party supplier remains solely responsible for the design, manufacture, sale and functionality of its products. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. *Other names and brands may be claimed as the property of others.]
Étiquettes:
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.