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 585461 - Problem compiling gjs with Sun Studio compiler
Problem compiling gjs with Sun Studio compiler
Status: RESOLVED DUPLICATE of bug 595447
Product: gjs
Classification: Bindings
Component: general
0.2
Other opensolaris
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2009-06-11 18:13 UTC by Brian Cameron
Modified: 2010-05-26 13:37 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Brian Cameron 2009-06-11 18:13:14 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.
Comment 1 Erwann Chenede 2010-05-26 13:37:11 UTC

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