From obrien@NUXI.com  Thu Nov 11 01:20:25 2004
Return-Path: <obrien@NUXI.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id EC3BF16A4CF
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Nov 2004 01:20:25 +0000 (GMT)
Received: from dragon.nuxi.com (trang.nuxi.com [66.93.134.19])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B5FBB43D53
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 11 Nov 2004 01:20:25 +0000 (GMT)
	(envelope-from obrien@NUXI.com)
Received: from dragon.nuxi.com (obrien@localhost [127.0.0.1])
	by dragon.nuxi.com (8.13.1/8.13.1) with ESMTP id iAB1KO8G035263
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 10 Nov 2004 17:20:24 -0800 (PST)
	(envelope-from obrien@dragon.nuxi.com)
Received: (from obrien@localhost)
	by dragon.nuxi.com (8.13.1/8.13.1/Submit) id iAB1KORP035262;
	Wed, 10 Nov 2004 17:20:24 -0800 (PST)
	(envelope-from obrien)
Message-Id: <200411110120.iAB1KORP035262@dragon.nuxi.com>
Date: Wed, 10 Nov 2004 17:20:24 -0800 (PST)
From: "David O'Brien" <obrien@freebsd.org>
Reply-To: "David O'Brien" <obrien@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Be causious compiling with -O2 (use -fno-strict-aliasing)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         73797
>Category:       ports
>Synopsis:       Be causious compiling with -O2 (use -fno-strict-aliasing)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    portmgr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 11 01:30:25 GMT 2004
>Closed-Date:    Wed Oct 19 19:25:30 GMT 2005
>Last-Modified:  Wed Oct 19 19:25:30 GMT 2005
>Originator:     David O'Brien
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD dragon.nuxi.com 6.0-CURRENT FreeBSD 6.0-CURRENT #447: Tue Oct 19 09:53:16 PDT 2004 rootk@dragon.nuxi.com:/FBSD/src/sys/i386/compile/DRAGON i386


	
>Description:
	Compiling with 'strict-aliasing' optimization breaks some [notable]
	ports.  GCC turns on 'strict-aliasing' optimization at all levels
	above -O[1], so explicitly turn it off when using compiling with
	"high" optimization levels.
	
>How-To-Repeat:
	Build Firefox and other ports with -O2 (or -Os or -O3).

>Fix:

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.499
diff -u -u -7 -r1.499 bsd.port.mk
--- bsd.port.mk	7 Oct 2004 17:59:18 -0000	1.499
+++ bsd.port.mk	11 Nov 2004 01:16:33 -0000
@@ -1222,14 +1223,17 @@
 .if defined(WITHOUT_CPU_CFLAGS)
 .if defined(_CPUCFLAGS)
 .if !empty(_CPUCFLAGS)
 CFLAGS:=	${CFLAGS:C/${_CPUCFLAGS}//}
 .endif
 .endif
 .endif
+.if ${CFLAGS:M-O[23s]} != ""
+CFLAGS+= -fno-strict-aliasing
+.endif
 
 .if defined(NOPORTDOCS)
 PLIST_SUB+=	        PORTDOCS="@comment "
 .else
 PLIST_SUB+=	        PORTDOCS=""
 .endif
 
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->portmgr 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Thu Nov 11 01:34:23 GMT 2004 
Responsible-Changed-Why:  
Over to portmgr for approval. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73797 

From: "David O'Brien" <obrien@NUXI.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:  
Subject: Re: ports/73797: Be causious compiling with -O2 (use -fno-strict-aliasing)
Date: Thu, 11 Nov 2004 08:44:24 -0800

 Note that when testing this PR, one should use src/share/mk/sys.mk rev 1.81.
State-Changed-From-To: open->closed 
State-Changed-By: clement 
State-Changed-When: Wed Oct 19 19:21:57 GMT 2005 
State-Changed-Why:  
This patch has been rejected since it breaks ports if users doesn't use  
gcc, or any gcc-compatible compilers. 
BTW, thanks for your patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73797 
>Unformatted:
