ports/73797: Be causious compiling with -O2 (use -fno-strict-aliasing)

David O'Brien obrien at FreeBSD.org
Thu Nov 11 01:30:26 UTC 2004


>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 at 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:



More information about the freebsd-ports-bugs mailing list