bugGNU gv - Bugs: bug #23972, gv-3.6.5 won't build on solaris 9...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #23972: gv-3.6.5 won't build on solaris 9 with sun studio 11 compiler

Submitted by:  David Diffenbaugh <davediff>
Submitted on:  Thu 31 Jul 2008 09:43:05 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Markus Steinborn <msteinbo>
Open/Closed: ClosedRelease: 3.6.5

Fri 01 Aug 2008 06:35:28 AM UTC, comment #1:

Thank cou for the bug report. The problem is: If I apply your patch, then

./configure CFLAGS="-Wall --pedantic --std=c99" ; make clean ; make

will result in

In file included from resource.c:54:
main_resources.h:245: Warnung: ISO-C verbietet leere Initialisierungsklammern
main_resources.h:244: Fehler: Feldgröße von »options« ist null oder negativ
make[2]: *** [resource.o] Fehler 1

on my linux system so it may break c89 and c99 compilers. Your warnimngs tell you that after the patch your code is not c99 compliant.

I need some investigation to decide what to do. Comments are welcome.

Markus Steinborn <msteinbo>
Project AdministratorIn charge of this item.
Thu 31 Jul 2008 09:43:05 PM UTC, original submission:

I'm getting this compilation error:

cc -DHAVE_CONFIG_H -I. -DNON_BLOCKING_IO -DGV_CODE -DGV_CODE -DGV_LIBDIR=\"/usr/local/lib/gv\" -I../lib -I../lib -g -I/usr/local/include -I/usr/openwin/include -DUSE_SETENV_CODE -g -c resource.c
"main_resources.h", line 244: zero or negative subscript
"main_resources.h", line 245: warning: syntax error: empty initializer
cc: acomp failed for resource.c

The relevant line of code is in gv-3.6.5/src/main_resources.h:

static XrmOptionDescRec options[0] = {
};

I believe declaring arrays with zero length is a gcc extension and causes this to break with Sun Studio 11 which is c99 compliant.

A link to a brief discussion of this:
http://developer.apple.com/documentation/DeveloperTools/gcc-4.0.1/gcc/Zero-Length.html

I attached a patch which leaves the zero out that compiles with only the following warnings:

"main_resources.h", line 245: warning: syntax error: empty initializer
"main_resources.h", line 245: warning: null dimension: options
"resource.c", line 342: warning: null dimension: sizeof()

I'm not sure if these are anything to worry about. I know that sizeof(options) will return 0 which seems sensible. After building this way gv appears to work fine while testing.

If this workaround looks correct, would it be possible to have it included in the next release so that gv can be compiled on Solaris 9 without these issues.

Thanks

David Diffenbaugh <davediff>

 

Attached Files
file #16218:  gv-zero-length.patch added by davediff (411B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by msteinbo (Posted a comment)
  • -unavailable- added by davediff (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 09 Aug 2008 04:03:24 PM UTCmsteinboStatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Fri 01 Aug 2008 04:03:13 PM UTCmsteinboStatusIn Progress=>Ready For Test
    Fri 01 Aug 2008 06:35:28 AM UTCmsteinboStatusNone=>In Progress
      Assigned toNone=>msteinbo
      ReleaseNone=>3.6.5
    Thu 31 Jul 2008 09:43:05 PM UTCdavediffAttached File-=>Added gv-zero-length.patch, #16218

    Back to the top


    Powered by Savane 3.1-cleanup1