Subject: pkg/23381: MesaLib, glu, glut compilation bug
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tls@netbsd.org>
List: netbsd-bugs
Date: 11/06/2003 23:52:37
>Number:         23381
>Category:       pkg
>Synopsis:       The Mesa configure script explicitly enables -fstrict-aliasing, but Mesa includes code that is *NOT* strict-alias safe.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 06 23:53:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Thor Lancelot Simon
>Release:        MesaLib/glu/glut 5.0.2 packages; pkgsrc as of 2003-10-31
>Organization:
	The NetBSD Project
>Environment:
System: NetBSD enola-gay 1.6ZE NetBSD 1.6ZE (ENOLA-GAY.MPBIOS) #0: Wed Oct 29 17:52:50 EST 2003  root@enola-gay:/u2/src/sys/arch/i386/compile/ENOLA-GAY.MPBIOS i386
Architecture: i386
Machine: i386
>Description:
The Mesa configure script explicitly enables -fstrict-aliasing.  This is
a *very* bad idea -- it even overrides -fno-strict-aliasing given on the
compiler command line.  Worse, compiling with GCC 3 yields repeated
warnings about type-punned pointers, making it clear that the use of
-fstrict-aliasing is not safe.

>How-To-Repeat:
Build the MesaLib, glu, or glut packages on a system with GCC 3.  Look at 
the build output and notice the many warnings about type-punning.  The
same problem exists with GCC 2, but GCC 2 doesn't have the type-punning
warning -- it *still* isn't safe to explicitly turn strict-aliasing on,
regardless of GCC version.

This is probably responsible for some reported crashes/hangs of GL
applications.

>Fix:

Patch the MesaLib autoconf stuff to explicitly add "-fno-strict-aliasing"
to the compile line instead of "-fstrict-aliasing".  This is necessary
for correct operation with GCC 3 anyway, since the source code contains
unsafe use of aliased pointers.

>Release-Note:
>Audit-Trail:
>Unformatted: