Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Nov 2004 17:20:24 -0800 (PST)
From:      "David O'Brien" <obrien@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/73797: Be causious compiling with -O2 (use -fno-strict-aliasing)
Message-ID:  <200411110120.iAB1KORP035262@dragon.nuxi.com>
Resent-Message-ID: <200411110130.iAB1UPE8058667@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         73797
>Category:       ports
>Synopsis:       Be causious compiling with -O2 (use -fno-strict-aliasing)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 11 01:30:25 GMT 2004
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200411110120.iAB1KORP035262>