From hsu@joutseno.wlansystems.com  Mon Nov 19 11:46:12 2007
Return-Path: <hsu@joutseno.wlansystems.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 239E716A41B
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Nov 2007 11:46:11 +0000 (UTC)
	(envelope-from hsu@joutseno.wlansystems.com)
Received: from joutseno.wlansystems.com (joutseno.wlansystems.com [212.16.100.99])
	by mx1.freebsd.org (Postfix) with ESMTP id 9A57D13C469
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Nov 2007 11:46:10 +0000 (UTC)
	(envelope-from hsu@joutseno.wlansystems.com)
Received: from joutseno.wlansystems.com (localhost [127.0.0.1])
	by joutseno.wlansystems.com (8.14.2/8.14.2) with ESMTP id lAJ5BGi5020852
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 19 Nov 2007 07:11:16 +0200 (EET)
	(envelope-from hsu@joutseno.wlansystems.com)
Received: (from hsu@localhost)
	by joutseno.wlansystems.com (8.14.2/8.14.2/Submit) id lAJ5BFdh020851;
	Mon, 19 Nov 2007 07:11:15 +0200 (EET)
	(envelope-from hsu)
Message-Id: <200711190511.lAJ5BFdh020851@joutseno.wlansystems.com>
Date: Mon, 19 Nov 2007 07:11:15 +0200 (EET)
From: Heikki Suonsivu <hsu@bbnetworks.net>
Reply-To: Heikki Suonsivu <hsu@bbnetworks.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: RELENG_7 kernel compile fails with -Os
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         118121
>Category:       misc
>Synopsis:       [build] RELENG_7 kernel compile fails with -Os
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 19 11:50:02 UTC 2007
>Closed-Date:    Wed Nov 24 00:20:20 UTC 2010
>Last-Modified:  Wed Nov 24 00:20:20 UTC 2010
>Originator:     Heikki Suonsivu
>Release:        FreeBSD 7.0-BETA3 i386
>Organization:
bbnetworks.net
>Environment:
System: FreeBSD joutseno.wlansystems.com 7.0-BETA3 FreeBSD 7.0-BETA3 #3: Sun Nov 18 02:20:02 EET 2007 hsu@joutseno.wlansystems.com:/usr/obj/usr/src/sys/GENERIC i386

	Anything with RELENG_7, if compiling GENERIC with -Os

>Description:

	When compiling kernel with -Os, gcc apparently finds some new
	possible warnings (possible uninitialized variables, etc).  This exits
	kernel compile.  -O2 does not trigger these.

	scsi_sa and scsi_ses were among the offending files, but there
	may be more.

>How-To-Repeat:

	build kernel with COPTFLAGS set to -Os -g -pipe

>Fix:

	The offending code may need further checks.  RELENG_6 did not
	have these warnings, so they apparently are related to new
	code in 7.x.

	Workaround is to use -O2 or -O

>Release-Note:
>Audit-Trail:

From: Bruce Evans <brde@optusnet.com.au>
To: Heikki Suonsivu <hsu@bbnetworks.net>
Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Subject: Re: kern/118121: RELENG_7 kernel compile fails with -Os
Date: Tue, 20 Nov 2007 17:14:49 +1100 (EST)

 On Mon, 19 Nov 2007, Heikki Suonsivu wrote:
 
 >> Description:
 >
 > 	When compiling kernel with -Os, gcc apparently finds some new
 > 	possible warnings (possible uninitialized variables, etc).  This exits
 > 	kernel compile.  -O2 does not trigger these.
 >
 > 	scsi_sa and scsi_ses were among the offending files, but there
 > 	may be more.
 
 -Os is also a large negative optimization (it increases size by about 50%)
 in RELENG_7 (or probably just with gcc-4), due to bogus inlining flags.
 
 Bruce
 
State-Changed-From-To: open->closed 
State-Changed-By: arundel 
State-Changed-When: Wed Nov 24 00:14:35 UTC 2010 
State-Changed-Why:  
I tried to reproduce this under HEAD (r215432; amd64) and TARGET buildkernel 
still fails! 
HOWEVER: since share/examples/etc/make.conf states the following: 

# CFLAGS controls the compiler settings used when compiling C code. 
# Note that optimization settings other than -O and -O2 are not recommended 
# or supported for compiling the world or the kernel - please revert any 
# nonstandard optimization settings to "-O" or "-O2 -fno-strict-aliasing" 
# before submitting bug reports without patches to the developers. 

i'm closing this PR. quite obviosly that statement applies even more so to 
COPTFLAGS. two more reasons for closing this PR are: 

1) nobody will care to fix code that gets broken by -Os 
2) gcc will eventually be removed from the src in favour if clang 

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