Unreachable code if catch {} path returns
@carlosg
Submitted by Carlos Garnacho Link to original bug (#778304)
Description
Created attachment 345138 reproducer
If a function has a try{} catch(){} block where either code block returns a value or throws a different kind of error, the "goto __finallyX;" call at the end of it is made unreachable, for the example attachment:
gchar* foo_bar (Foo* self, GError** error) {
...
{
...
_tmp1_ = g_file_read_link ("/home", &_inner_error_);
_tmp0_ = _tmp1_;
if (G_UNLIKELY (_inner_error_ != NULL)) {
goto __catch0_g_error;
}
...
return result;
}
goto __finally0;
__catch0_g_error:
...
__finally0:
...
}
This triggers a number of Coverity warnings for Tracker, the CIDs are:
1388519, 1388518, 1388517, 1388516, 1388515, 1388514, 1388512, 1388511, 1388509, 1388508, 1388500, 1388492, 1388484, 1388483.
Attachment 345138, "reproducer":
test3.vala
Edited by Corentin Noël