Almost 3 years later.. The problem lies in the Label instruction. What happens when you have code that contains labels and gotos is that the Goto instructions are successfully converted to valid jump op-codes. The labels, however, are just, well, labels. They don't even have a meaning, because jumps in compiled code are converted to jumps to a line number. Therefore, they are turned into no-ops. this can be seen in this example:
fun = Compile[{{a, _Real, 0}},
Module[{x = 1., xp = 0., begin, end},
Label[begin];
If[Abs[xp - x] < 10^-8, Goto[end]];
xp = x;
x = (x + a/x)/2;
Goto[begin];
Label[end];
x]
]
Look at fun // InputForm and you will find {0, begin} which means op-code 0 for "nothing". When a C function is to be constructed from this compiled function, every op-code is converted into its C form. Like this:
<< CompiledFunctionTools`
CompiledFunctionTools`Private`getInstruction[0, {16, 0, 1}]
(* Instruction[Times, Register[Real, 1], {Register[Real, 0]}] *)
Unfortunately, it seems to be an oversight that exactly this is not implemented for the noop code. Since it cannot be turned into a valid instruction, the C-compiler will never get a valid instruction list. Look at the error

Can we fix this? Surely. The question is what is the next best instruction for a noop instruction? Well, jump to the next line sounds reasonable.
To understand why this works you have to know that jumps to labels are turned into jumps to line numbers. So we don't really need the labels at all at this stage anymore.
Unprotect[CompiledFunctionTools`Private`getInstruction];
CompiledFunctionTools`Private`getInstruction[line_, {0, _}] :=
CompiledFunctionTools`Private`getInstruction[line, {3, 1}]
Instruction {3,1} is a jump (3) to the line: current line + 1.
fun = Compile[{{a, _Real, 0}},
Module[{x = 1., xp = 0., begin, end},
Label[begin];
If[Abs[xp - x] < 10^-8, Goto[end]];
xp = x;
x = (x + a/x)/2;
Goto[begin];
Label[end];
x], CompilationTarget -> "C"
]
fun[2]
(* 1.41421 *)
it says it is compilable. How can I for example rephrase
– MOON Feb 11 '15 at 16:43fun2withoutGoto?CompilationTarget->"C"option. Works fine for other (or no) target specified. For your example you can just put the code blocks inside theIf. – george2079 Feb 11 '15 at 17:08If. Thank you. – MOON Feb 11 '15 at 17:22