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

hello world throwing seg fault

ankit_m_
Beginner
720 Views

Hello,

I am trying to compile and run a very simple Hello world program using icpc. Nothing fancy, what I do is following,

#include <iostream>

using namespace std;

int main()
{
        cout << " hello " << endl;
        return 0;
}

~

I compile the above code using

icpc hello.cpp -o hh

compilation works just fine but when I try to run this I get "segmentation fault" I am not sure what is causing this error. Could anyone please help trouble shoot this.

 

0 Kudos
5 Replies
Bernard
Valued Contributor I
720 Views

Can you provide dump file?I suppose that you are using Linux.

0 Kudos
QIAOMIN_Q_
New Contributor I
720 Views

Please provide the icc and gcc's version ,and which operating system are you using? and what's the output of 'ulimit -s'?

 

Thank you.
--
QIAOMIN.Q
Intel Developer Support

User forums:                   http://software.intel.com/en-us/forums/

0 Kudos
Bernard
Valued Contributor I
720 Views

>>> I get "segmentation fault" I am not sure what is causing this error>>>

By inspecting your code I suppose that possible "candidate" for segfault error could be hello string.One of the reason could be unbalanced stack when the push offset hello instruction generates segfault.Without the seeing the disassembly it is just speculation.

0 Kudos
bernaske
New Contributor I
720 Views

Hi,

i have your simple, sample program compile under openSUSE Factory ( Version 13.2 ) with

the Intel Parallel Studio XE Sp1 for Linux ( 64 Bit )

no problems, the same under openSUSE 12.3 and openSUSE 13.1

regards

 

Franz

 

 

0 Kudos
Bernard
Valued Contributor I
720 Views

On the other hand the segfault could have originated inside cout object code.

0 Kudos
Reply