Go code expects to be able to do a reliable backtrace and get correct file/line information of callers. This is broken by -fipa-icf-functions, so this Go frontend patch disables that option by default. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline.
Ian * go-lang.c (go_langhook_post_options): Disable -fipa-icf-functions if it was not explicitly enabled.
diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index 2cfb41042bd..08c1f38a2c1 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -306,6 +306,12 @@ go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED) SET_OPTION_IF_UNSET (&global_options, &global_options_set, flag_partial_inlining, 0); + /* Go programs expect runtime.Callers to give the right answers, + which means that we can't combine functions even if they look the + same. */ + SET_OPTION_IF_UNSET (&global_options, &global_options_set, + flag_ipa_icf_functions, 0); + /* If the debug info level is still 1, as set in init_options, make sure that some debugging type is selected. */ if (global_options.x_debug_info_level == DINFO_LEVEL_TERSE