Runtime stack check routine failure with AVX

Published: 05/31/2011, Last Updated: 05/31/2011


Reference Number : 

Version : 

Product : 
Intel Composer XE

Operating System : 

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.
#include <iostream>
#include "immintrin.h"
	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);
                avxBuffer[0] = _mm256_set1_ps(0.0f);
                avxBuffer[1] = _mm256_set1_ps(0.0f);
                avxBuffer[2] = _mm256_set1_ps(0.0f);

int main(int argc, char* argv[])
       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 Build 20101116
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.

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


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.]

Product and Performance Information


Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804