[Bug 3470] New: unzip.c compile fails Solaris/SPARC with Sun C compiler

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Tue Dec 11 15:19:46 EST 2007


http://bugzilla.icculus.org/show_bug.cgi?id=3470

           Summary: unzip.c compile fails Solaris/SPARC with Sun C compiler
           Product: Quake 3
           Version: SVN HEAD
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: minor
          Priority: P3
         Component: Misc
        AssignedTo: zakk at icculus.org
        ReportedBy: baggett.patrick at figglesoftware.com
         QAContact: quake3-bugzilla at icculus.org


I have modified the default makefile to use Sun's C compiler instead of GCC
like the maintainer Vincent uses since Sun's C compiler generally produces much
better code than GCC. In the compilation process, unzip.c had an error about
converting from void* type to a function pointer type on line 4051.

inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w))

Changing the Z_NULL (which is of type void*), to the correct typedef'd function
pointer type as used by inflate_blocks_new()'s prototype fixes the error. 

inflate_blocks_new(z, z->state->nowrap ? ((check_func)0) : adler32, (uInt)1 <<
w))

Reasoning: ISO C forbids the typecast from data pointer to function pointer.
Sun's C compiler refuses to output just a warning and instead raises it to an
error status when seen. GCC and MSVC usually emit a warning that notes that
this is actually forbidded by the C standard. To me honestly, pointers are
pointers, but the ISO C standard also gives aliasing rules based on typecasts
between types (see http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html
for information/examples), and technically it is possible for the compiler to
legally output incorrect code in such mentioned cases.

Reported against revision 1232.

Patrick Baggett
Figgle Software


-- 
Configure bugmail: http://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the quake3-bugzilla mailing list