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 576611 - Array-of-arrays won't compile
Array-of-arrays won't compile
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Arrays
0.5.x
Other All
: Normal major
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-24 20:41 UTC by Jim Nelson
Modified: 2010-10-16 13:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase (192 bytes, text/plain)
2009-04-30 18:47 UTC, Rob Taylor
Details

Description Jim Nelson 2009-03-24 20:41:32 UTC
Please describe the problem:
When pointing an array-of-arrays to another array-of-arrays, valac CRITICAL errors are logged and gdb fails on the .c files.  It appears the generated .c code is not supplying enough parameters to a generated helper function.

Steps to reproduce:
I'm using this source:

void main(string[] args) {
    int[][] foo = new int[3][4];
    int[][] bar = foo;
    
    stdout.printf("%d", bar.length);
}

Actual results:
valac produces this:

** (valac:22089): CRITICAL **: vala_ccode_array_module_real_get_array_length_cexpression: assertion `array_expr != NULL' failed

** (valac:22089): CRITICAL **: vala_ccode_function_call_add_argument: assertion `expr != NULL' failed
foo.c: In function ‘_vala_array_dup1’:
foo.c:25: error: too few arguments to function ‘_vala_array_dup2’
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)


Expected results:
Compile without error.

Does this happen every time?
Yes.

Other information:
Comment 1 Rob Taylor 2009-04-30 18:46:21 UTC
I have hit a problem that seems to be an instance of the same bug. Testcase is attached.

valac output:

** (valac:14780): CRITICAL **: vala_ccode_array_module_real_get_array_length_cexpression: assertion `array_expr != NULL' failed

** (valac:14780): CRITICAL **: vala_ccode_function_call_add_argument: assertion `expr != NULL' failed
test.vala.c: In function ‘_main’:
test.vala.c:61: error: too few arguments to function ‘_vala_array_dup1’
test.vala.c:76: warning: format not a string literal and no format arguments
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)
Comment 2 Rob Taylor 2009-04-30 18:47:36 UTC
Created attachment 133683 [details]
Testcase
Comment 3 Jürg Billeter 2010-10-16 13:44:07 UTC
commit cc435dd6ec069b87e986fa454e80e5fe80a0df72
Author: Jürg Billeter <j@bitron.ch>
Date:   Sat Oct 16 15:17:23 2010 +0200

    Report error when trying to use stacked arrays
    
    Stacked array support was never completed. Report an error instead of
    generating incorrect C code.
    
    Fixes bug 546603, bug 548428, bug 548429, bug 565865, bug 565872,
    bug 571322, bug 572649, and bug 576611.