GNOME Bugzilla – Bug 576611
Array-of-arrays won't compile
Last modified: 2010-10-16 13:44:07 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:
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)
Created attachment 133683 [details] Testcase
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.