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 734925 - Extending null-terminated array without length results in assertion in valac
Extending null-terminated array without length results in assertion in valac
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Semantic Analyzer
0.25.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2014-08-16 22:48 UTC by Maciej (Matthew) Piechotka
Modified: 2018-05-22 15:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Maciej (Matthew) Piechotka 2014-08-16 22:48:09 UTC
Code:

[CCode (array_length = false, array_null_terminated = true)]
internal uint[]? sizes;
...
sizes += 0;

Results in assertion error:

ERROR:valaccodearraymodule.c:1105:vala_ccode_array_module_real_get_array_length_cvalue: assertion failed: (size != null && size.size >= dim)

(Probably dynamic guess of length and assumption that size == length or just erroring out would be better).
Comment 1 Maciej (Matthew) Piechotka 2014-08-16 22:54:52 UTC
For that matter following code is also running into similar problem:

[CCode (array_length = false, array_null_terminated = true)]
internal uint[]? sizes;
// ...
var tmp = foo();
tmp += 0
sizes = (owned)tmp;
// Or sizes = tmp;

This makes GLib.OptionArg default arguments awkward to use.
Comment 2 Maciej (Matthew) Piechotka 2014-08-16 23:03:44 UTC
(In reply to comment #1)
> For that matter following code is also running into similar problem:
> 
> [CCode (array_length = false, array_null_terminated = true)]
> internal uint[]? sizes;
> // ...
> var tmp = foo();
> tmp += 0
> sizes = (owned)tmp;
> // Or sizes = tmp;
> 
> This makes GLib.OptionArg default arguments awkward to use.

Ups. Sorry - I had the same problem in the same file in different place.
Comment 3 GNOME Infrastructure Team 2018-05-22 15:15:12 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/467.