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 619153 - Nullable out parameter segfault when checked for null
Nullable out parameter segfault when checked for null
Status: RESOLVED DUPLICATE of bug 591673
Product: vala
Classification: Core
Component: Control Flow Statements
0.8.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2010-05-20 00:24 UTC by Jim Nelson
Modified: 2010-06-16 19:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Minimal test case (231 bytes, text/x-vala)
2010-05-20 00:24 UTC, Jim Nelson
Details

Description Jim Nelson 2010-05-20 00:24:26 UTC
This function:

void out_class(out Class? c) {
    if (c != null)
        c = new Class();
}

generates this C code:

void out_class (Class** c) {
	if (c != NULL) {
		*c = NULL;
	}

        // The problem is here when c is NULL
	if ((*c) != NULL) {
		Class* _tmp0_;
		*c = (_tmp0_ = class_new (), _class_unref0 (*c), _tmp0_);
	}
}
Comment 1 Jim Nelson 2010-05-20 00:24:49 UTC
Created attachment 161508 [details]
Minimal test case
Comment 2 Luca Bruno 2010-05-27 18:47:37 UTC
SImply you can't pass null to out parameters, Vala does not null check each operation, otherwise you'll end up with a bunch of null checks. This is a limitation of the syntax evidently that you can't access the address of the parameter... I don't know if this is good or not.
Comment 3 Jürg Billeter 2010-06-16 19:51:28 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 591673 ***