Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

c++ std::sort intel compiler error : access violation

luca_a_1
Beginner
571 Views

Hi,

I'm having some trouble compiling the following code snippet

#include <algorithm>
#define SIZE (1000)

struct S {
	int *vect;
};

int main() {
	
	struct S* s = (struct S*)(malloc(sizeof(struct S)));

	s->vect = (int*)(malloc(sizeof(int) * SIZE));

	for(int i = 0; i < SIZE; i++) {
		s->vect = i;
	}

	std::sort(s->vect, s->vect + SIZE);

}

The compiler returns the following error related to the std::sort call

1>C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Enterprise\VC\Tools\MSVC\14.12.25827\include\algorithm(3138): 
error : access violation
1>              return (pair<_RanIt, _RanIt>(_Pfirst, _Plast));
1>                      ^

I'm using visual studio enterprise 2017 version 15.5.2 and the intel compiler 64 bit version 17.0.4.210 Build 20170411.

The code used to work before the latest visual studio update.

Thanks in advance.

0 Kudos
2 Replies
jase439
Beginner
571 Views

Hi Luca,

VS studio update 15.5.x breaks Intel Compiler 2017 unfortunately. Your only option at present is to go back to 15.4.4 (reinstall Visual Studio) or to install Intel Compiler 2018 Update 1.

Sorry for the bad news.

Happy holidays.

J

0 Kudos
luca_a_1
Beginner
571 Views
Hi Jason, thank you for your reply. Happy holidays to you too! Luca
0 Kudos
Reply