GNOME Bugzilla – Bug 585461
Problem compiling gjs with Sun Studio compiler
Last modified: 2010-05-26 13:37:11 UTC
The file gjs/gi/arg.c in SVN master contains this code in the function gjs_array_to_intarray: 436 union { guint8 u8[0]; guint16 u16[0]; guint32 u32[0]; } *result; [...] 441 for (i = 0; i < length; ++i) { [...] 466 /* Note that this is truncating assignment. */ 467 switch (intsize) { 468 case 1: 469 result->u8[i] = (gint8) intval.u; break; 470 case 2: 471 result->u16[i] = (gint16) intval.u; break; 472 case 4: 473 result->u32[i] = (gint32) intval.u; break; 474 default: 475 g_assert_not_reached(); 476 } 477 } When compiling the file with the Sun Studio compiler on Solaris, I get these errors: "gi/arg.c", line 436: zero or negative subscript "gi/arg.c", line 436: zero or negative subscript "gi/arg.c", line 436: zero or negative subscript "gi/arg.c", line 436: zero-sized struct/union Can the gjs experts recommend how this code could be reworked to avoid these errors? It does seem odd that the arrays are initialized with 0 size, and then set a value like this.
*** This bug has been marked as a duplicate of bug 595447 ***