Diagnostic 111: statement is unreachable

Submit New Article

December 26, 2008 11:00 PM PST



Cause

Statements at the given location will never be executed. This might occur due to incorrectly placed unconditional statements like return, goto or throw.


Example

 

void foo1(){
int i;
return;
i++; // remark 111 generated here
}
void foo2(int i)
{
if (i==1) {
goto _label;
return; // remark 111 generated here
}
_label: i++;
}
void foo3()
{
while(1); // infinite loop
return; // remark 111 generated here
}

 

Default type: "remark"

>icl /W4 /c test.cpp
Intel(R) C++ Compiler Professional for applications running on IA-32, Version 11
.0 Build 20080930 Package ID: w_cproc_p_11.0.061
Copyright (C) 1985-2008 Intel Corporation. All rights reserved.
test.cpp
test.cpp(4): remark #111: statement is unreachable
i++; // remark 111 generated here
^
test.cpp(10): remark #111: statement is unreachable
return; // remark 111 generated here
^

test.cpp(17): remark #111: statement is unreachable
return; // remark 111 generated here
^


Resolution:
  • Remove the unneccessary code.
  • Check for the improperly placed control tranfer statements.
  • This diagnostic can be safely ignored

 




Do you need more help?


This article applies to: Intel® C++ Compiler for Linux* Knowledge Base,   Intel® C++ Compiler for Mac OS X* Knowledge Base,   Intel® C++ Compiler for Windows* Knowledge Base,   Intel® Parallel Composer Knowledge Base