buggy optimization levels...
Chuck Swiger
cswiger at mac.com
Thu Jul 31 18:34:26 PDT 2003
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
More information about the freebsd-questions
mailing list