Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7679 Discussions

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

luca_a_1
Beginner
284 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
284 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

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