From owner-freebsd-questions@FreeBSD.ORG Thu Jul 31 18:34:25 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EBD0037B401 for ; Thu, 31 Jul 2003 18:34:25 -0700 (PDT) Received: from out004.verizon.net (out004pub.verizon.net [206.46.170.142]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2759F43F93 for ; Thu, 31 Jul 2003 18:34:25 -0700 (PDT) (envelope-from cswiger@mac.com) Received: from mac.com ([151.205.189.55]) by out004.verizon.net (InterMail vM.5.01.05.33 201-253-122-126-133-20030313) with ESMTP id <20030801013424.WMOI14849.out004.verizon.net@mac.com> for ; Thu, 31 Jul 2003 20:34:24 -0500 Message-ID: <3F29C399.6070108@mac.com> Date: Thu, 31 Jul 2003 21:34:17 -0400 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd Questions References: <3F1322A9.8080805@mac.com> <20030731225137.GA15353@rot13.obsecurity.org> In-Reply-To: <20030731225137.GA15353@rot13.obsecurity.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Authentication-Info: Submitted using SMTP AUTH at out004.verizon.net from [151.205.189.55] at Thu, 31 Jul 2003 20:34:24 -0500 Subject: Re: buggy optimization levels... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Aug 2003 01:34:26 -0000 Kris Kennaway wrote: > On Mon, Jul 14, 2003 at 05:37:45PM -0400, Chuck Swiger wrote: >> The "known bugs" section of the GCC info documentation lists 5 issues; "man >> gcc" lists none. Can someone provide a test case for a bug involving "cc >> -O" versus "cc -O3" under FreeBSD 4-STABLE for the x86 architecture? > > Probably not, or it would have already been fixed. Hopefully so, as the compiler toolchain is important. :-) > The warning against using FreeBSD with settings higher than -O1 (== > -O) is because it often causes bugs that are difficult to track down > (e.g. some aspect of the kernel just doesn't work properly). OK. Can the existence of such problems be confirmed reliably, say by regression testing? /usr/src/contrib/gcc/toplev.c is clear enough which specific optimizations are involved at the different number levels: if (optimize >= 1) { flag_defer_pop = 1; flag_thread_jumps = 1; #ifdef DELAY_SLOTS flag_delayed_branch = 1; #endif #ifdef CAN_DEBUG_WITHOUT_FP flag_omit_frame_pointer = 1; #endif } if (optimize >= 2) { flag_cse_follow_jumps = 1; flag_cse_skip_blocks = 1; flag_gcse = 1; flag_expensive_optimizations = 1; flag_strength_reduce = 1; flag_rerun_cse_after_loop = 1; flag_rerun_loop_opt = 1; flag_caller_saves = 1; flag_force_mem = 1; #ifdef INSN_SCHEDULING flag_schedule_insns = 1; flag_schedule_insns_after_reload = 1; #endif flag_regmove = 1; } if (optimize >= 3) { flag_inline_functions = 1; } Couldn't one compile with "cc -O -finline-functions", and then iterate through "-fcse-follow-jumps", "-fgcse", etc and see which optimizations are safe? -- -Chuck