After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 778304 - Unreachable code if catch {} path returns
Unreachable code if catch {} path returns
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Code Generator: GError
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-02-07 19:31 UTC by Carlos Garnacho
Modified: 2018-05-22 15:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
reproducer (376 bytes, text/plain)
2017-02-07 19:31 UTC, Carlos Garnacho
  Details
errormodule: Don't write unreachable goto-statement (967 bytes, patch)
2017-02-18 12:04 UTC, Rico Tzschichholz
needs-work Details | Review

Description Carlos Garnacho 2017-02-07 19:31:24 UTC
Created attachment 345138 [details]
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.
Comment 1 Rico Tzschichholz 2017-02-18 12:04:31 UTC
Created attachment 346125 [details] [review]
errormodule: Don't write unreachable goto-statement
Comment 2 Rico Tzschichholz 2017-02-25 07:53:33 UTC
Comment on attachment 346125 [details] [review]
errormodule: Don't write unreachable goto-statement

Only the first goto can be dropped not all.
Comment 3 GNOME Infrastructure Team 2018-05-22 15:44:38 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/577.