https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121319
Bug ID: 121319 Summary: Why is global_options.x_flag_pcc_struct_return cleared? Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: crazylht at gmail dot com, ubizjak at gmail dot com Target Milestone: --- Target: x86_64 i386 has gnu-user-common.h:#undef DEFAULT_PCC_STRUCT_RETURN gnu-user-common.h:#define DEFAULT_PCC_STRUCT_RETURN 1 But there are: /* Implement TARGET_OPTION_INIT_STRUCT. */ static void ix86_option_init_struct (struct gcc_options *opts) { if (TARGET_MACHO) /* The Darwin libraries never set errno, so we might as well avoid calling them when that's the only reason we would. */ opts->x_flag_errno_math = 0; opts->x_flag_pcc_struct_return = 2; opts->x_flag_asynchronous_unwind_tables = 2; } static void ix86_recompute_optlev_based_flags (struct gcc_options *opts, struct gcc_options *opts_set) { /* Set the default values for switches whose default depends on TARGET_64BIT in case they weren't overwritten by command line options. */ if (TARGET_64BIT_P (opts->x_ix86_isa_flags)) { if (opts->x_optimize >= 1) SET_OPTION_IF_UNSET (opts, opts_set, flag_omit_frame_pointer, !USE_IX86_FRAME_POINTER); if (opts->x_flag_asynchronous_unwind_tables && TARGET_64BIT_MS_ABI) SET_OPTION_IF_UNSET (opts, opts_set, flag_unwind_tables, 1); if (opts->x_flag_asynchronous_unwind_tables == 2) opts->x_flag_unwind_tables = opts->x_flag_asynchronous_unwind_tables = 1; if (opts->x_flag_pcc_struct_return == 2) opts->x_flag_pcc_struct_return = 0; } else { if (opts->x_optimize >= 1) SET_OPTION_IF_UNSET (opts, opts_set, flag_omit_frame_pointer, !(USE_IX86_FRAME_POINTER || opts->x_optimize_size)); if (opts->x_flag_asynchronous_unwind_tables == 2) opts->x_flag_asynchronous_unwind_tables = !USE_IX86_FRAME_POINTER; if (opts->x_flag_pcc_struct_return == 2) { /* Intel MCU psABI specifies that -freg-struct-return should be on. Instead of setting DEFAULT_PCC_STRUCT_RETURN to 0, we check -miamcu so that -freg-struct-return is always turned on if -miamcu is used. */ if (TARGET_IAMCU_P (opts->x_target_flags)) opts->x_flag_pcc_struct_return = 0; else opts->x_flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN; } } /* Keep nonleaf frame pointers. */ if (opts->x_flag_omit_frame_pointer) opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER; else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags)) opts->x_flag_omit_frame_pointer = 1; } For x86-64, global_options.x_flag_pcc_struct_return is always 0 and DEFAULT_PCC_STRUCT_RETURN is ignored.