This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Dataflow bug [RE: Large number of fortran testsuite failures]
On 12 June 2007 13:13, Paul Richard Thomas wrote:
>> You will excuse me please if I cannot identify the patch that is
>> responsible - this sort of investigation is just a bit too tedious
>> under Cygwin. I will make one further reversion this morning and will
>> report if I have bracketed the problem.
>>
>
> The problem is between r125620 and r125628 but is NOT, as I suspected,
> r125621.
>
> Is nobody else seeing it, or is it a Cygwin specific problem?
Dunno, because I'm on cygwin too. Stack gots messed up:
Program received signal SIGSEGV, Segmentation fault.
0x004ecbee in ix86_expand_prologue () at /gnu/gcc/gcc/gcc/df.h:973
973 if (index < df_live->block_info_size)
(gdb) bt
#0 0x004ecbee in ix86_expand_prologue () at /gnu/gcc/gcc/gcc/df.h:973
#1 0x0079a71f in gen_prologue ()
at /gnu/gcc/gcc/gcc/config/i386/i386.md:14460
#2 0x0023c938 in ?? ()
#3 0x006174b6 in thread_prologue_and_epilogue_insns ()
at /gnu/gcc/gcc/gcc/function.c:5060
#4 0x00000000 in ?? ()
(gdb)
By breaking on thread_prologue_and_epilogue_insns, you can see the whole
thing before the segfault:
Breakpoint 1, thread_prologue_and_epilogue_insns ()
at /gnu/gcc/gcc/gcc/function.c:5059
5059 start_sequence ();
(gdb) c
Continuing.
Breakpoint 1, thread_prologue_and_epilogue_insns ()
at /gnu/gcc/gcc/gcc/function.c:5059
5059 start_sequence ();
(gdb) bt
#0 thread_prologue_and_epilogue_insns () at /gnu/gcc/gcc/gcc/function.c:5059
#1 0x006180d0 in rest_of_handle_thread_prologue_and_epilogue ()
at /gnu/gcc/gcc/gcc/function.c:5485
#2 0x006a77ef in execute_one_pass (pass=0xa8d9b0)
at /gnu/gcc/gcc/gcc/passes.c:1123
#3 0x006a79e7 in execute_pass_list (pass=0xa90e40)
at /gnu/gcc/gcc/gcc/passes.c:1176
#4 0x006a79fa in execute_pass_list (pass=0xa8d930)
at /gnu/gcc/gcc/gcc/passes.c:1177
#5 0x006a79fa in execute_pass_list (pass=0xa8d7e0)
at /gnu/gcc/gcc/gcc/passes.c:1177
#6 0x006bdb9f in tree_rest_of_compilation (fndecl=0x7fe3bc00)
at /gnu/gcc/gcc/gcc/tree-optimize.c:406
#7 0x006a9431 in cgraph_expand_function (node=0x7fe3bd00)
at /gnu/gcc/gcc/gcc/cgraphunit.c:1073
#8 0x006aa710 in cgraph_assemble_pending_functions ()
at /gnu/gcc/gcc/gcc/cgraphunit.c:436
#9 0x006aab95 in cgraph_finalize_function (decl=0x7fe3bc00, nested=0)
at /gnu/gcc/gcc/gcc/cgraphunit.c:553
#10 0x004818d6 in gfc_generate_function_code (ns=0x1ab44a0)
at /gnu/gcc/gcc/gcc/fortran/trans-decl.c:3285
#11 0x00443d23 in gfc_parse_file () at /gnu/gcc/gcc/gcc/fortran/parse.c:3272
#12 0x00464940 in gfc_be_parse_file (set_yydebug=0)
at /gnu/gcc/gcc/gcc/fortran/f95-lang.c:301
#13 0x0050e5a5 in toplev_main (argc=15, argv=0x1a78f18)
at /gnu/gcc/gcc/gcc/toplev.c:1051
#14 0x004a8cef in main (argc=2346392, argv=0x61006148)
at /gnu/gcc/gcc/gcc/main.c:35
From there we go to gen_prologue. The stack isn't actually messed up, gdb
just seems to have trouble tracing back through a function derived from the md
file. gen_prologue calls ix86_expand_prologue and I stepped through that for
a bit:
(gdb) s
ix86_expand_prologue () at /gnu/gcc/gcc/gcc/config/i386/i386.c:5974
5974 ix86_compute_frame_layout (&frame);
(gdb) bt
#0 ix86_expand_prologue () at /gnu/gcc/gcc/gcc/config/i386/i386.c:5974
#1 0x0079a71f in gen_prologue ()
at /gnu/gcc/gcc/gcc/config/i386/i386.md:14460
#2 0x0023c938 in ?? ()
#3 0x006174b6 in thread_prologue_and_epilogue_insns ()
at /gnu/gcc/gcc/gcc/function.c:5060
#4 0x00000000 in ?? ()
(gdb) n
5976 if (cfun->machine->force_align_arg_pointer)
(gdb) print cfun
$2 = (struct function *) 0x7ff60348
(gdb) print *cfun
$3 = {eh = 0x7ff404d0, expr = 0x7fe5ad80, emit = 0x7ff72820,
varasm = 0x7ff115a8, cfg = 0x7fe5ab60, gimple_df = 0x0,
x_current_loops = 0x0, value_histograms = 0x0, decl = 0x7fe3bc00,
outer = 0x0, pops_args = 0, args_size = 8, pretend_args_size = 0,
outgoing_args_size = 0, arg_offset_rtx = 0x7ff10250, args_info = {
words = 2, nregs = 0, regno = 0, fastcall = 0, sse_words = 0,
sse_nregs = 0, warn_sse = 1, warn_mmx = 1, sse_regno = 0, mmx_words = 0,
mmx_nregs = 0, mmx_regno = 0, maybe_vaarg = 0, float_in_sse = 0},
return_rtx = 0x0, internal_arg_pointer = 0x7ff20040,
hard_reg_initial_vals = 0x0, x_nonlocal_goto_handler_labels = 0x0,
x_return_label = 0x0, x_naked_return_label = 0x0,
x_stack_slot_list = 0x7fe88b70, x_stack_check_probe_note = 0x0,
x_arg_pointer_save_area = 0x0, x_frame_offset = -32352,
static_chain_decl = 0x0, nonlocal_goto_save_area = 0x0,
x_parm_birth_insn = 0x7fe5aee0, x_used_temp_slots = 0x7fe83bd0,
x_avail_temp_slots = 0x0, fixup_var_refs_queue = 0x0,
x_temp_slot_level = 0, inl_max_label_num = 0, funcdef_no = 3,
machine = 0x7ff71740, stack_alignment_needed = 64,
preferred_stack_boundary = 128, language = 0x0, used_types_hash = 0x0,
epilogue_delay_list = 0x0, max_jumptable_ents = 0, last_label_uid = 8,
function_end_locus = {
file = 0x1a8dbc0 "/gnu/gcc/gcc/gcc/testsuite/gfortran.dg/sizeof.f90",
line = 37}, unexpanded_var_list = 0x0, hot_section_label = 0x0,
cold_section_label = 0x0, hot_section_end_label = 0x0,
cold_section_end_label = 0x0, unlikely_text_section_name = 0x0,
stack_protect_guard = 0x0, curr_properties = 264, last_verified = 8,
va_list_gpr_size = 255, va_list_fpr_size = 255,
function_frequency = FUNCTION_FREQUENCY_NORMAL, returns_struct = 0,
returns_pcc_struct = 0, returns_pointer = 0, calls_setjmp = 0,
calls_alloca = 0, accesses_prior_frames = 0, calls_eh_return = 0,
has_nonlocal_label = 0, calls_unwind_init = 0, has_nonlocal_goto = 0,
is_thunk = 0, all_throwers_are_sibcalls = 0, profile = 0, limit_stack = 0,
stdarg = 0, x_dont_save_pending_sizes_p = 1, uses_const_pool = 0,
uses_pic_offset_table = 0, uses_eh_lsda = 0,
arg_pointer_save_area_init = 0, after_inlining = 1,
recursive_call_emit = 0, tail_call_emit = 0, gimplified = 1}
(gdb) step
6025 if (frame_pointer_needed)
(gdb)
6027 insn = emit_insn (gen_push (hard_frame_pointer_rtx));
(gdb) n
6028 RTX_FRAME_RELATED_P (insn) = 1;
(gdb)
6030 insn = emit_move_insn (hard_frame_pointer_rtx,
stack_pointer_rtx);
(gdb)
6031 RTX_FRAME_RELATED_P (insn) = 1;
(gdb)
6036 if (!frame.save_regs_using_mov)
(gdb)
6034 allocate = frame.to_allocate;
(gdb)
6036 if (!frame.save_regs_using_mov)
(gdb)
5846 if (ix86_save_reg (regno, true))
(gdb)
5845 for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0; )
(gdb)
5846 if (ix86_save_reg (regno, true))
(gdb)
[ ... snip many loop iterations ... ]
5846 if (ix86_save_reg (regno, true))
(gdb)
5845 for (regno = FIRST_PSEUDO_REGISTER; regno-- > 0; )
(gdb)
6043 if (TARGET_RED_ZONE && frame.save_regs_using_mov)
(gdb)
6048 if (allocate == 0)
(gdb)
6050 else if (! TARGET_STACK_PROBE || allocate < CHECK_STACK_LIMIT)
(gdb)
6056 rtx eax = gen_rtx_REG (Pmode, 0);
(gdb)
973 if (index < df_live->block_info_size)
(gdb)
6056 rtx eax = gen_rtx_REG (Pmode, 0);
(gdb)
3018 return REGNO_REG_SET_P (DF_LIVE_OUT (ENTRY_BLOCK_PTR), 0);
(gdb)
973 if (index < df_live->block_info_size)
(gdb)
Program received signal SIGSEGV, Segmentation fault.
0x004ecbee in ix86_expand_prologue () at /gnu/gcc/gcc/gcc/df.h:973
973 if (index < df_live->block_info_size)
(gdb) thread 1
[Switching to thread 1 (thread 3316.0x25c)]#0 0x004ecbee in
ix86_expand_prologue () at /gnu/gcc/gcc/gcc/df.h:973
973 if (index < df_live->block_info_size)
(gdb) list
968 }
969
970 static inline struct df_live_bb_info *
971 df_live_get_bb_info (unsigned int index)
972 {
973 if (index < df_live->block_info_size)
974 return (struct df_live_bb_info *) df_live->block_info[index];
975 else
976 return NULL;
977 }
(gdb) info locals
eax = (rtx) 0x7fe8af20
t = (rtx) 0x0
insn = (rtx) 0x7e60
pic_reg_used = 0 '\0'
frame = {nregs = 2, padding1 = 0, va_arg_size = 0, frame = 2344936,
padding2 = 0, outgoing_arguments_size = 0, red_zone_size = 0,
to_allocate = 32352, frame_pointer_offset = 16,
hard_frame_pointer_offset = 8, stack_pointer_offset = 32368,
save_regs_using_mov = 0 '\0'}
allocate = 32352
__FUNCTION__ = "ix86_expand_prologue"
(gdb) print df
$4 = (struct df *) 0x1ab58b8
(gdb) print *df
$5 = {problems_in_order = {0x1adad68, 0x1ada980, 0x1ad6850, 0x0, 0x0, 0x0,
0x0, 0x0}, problems_by_index = {0x1adad68, 0x1ada980, 0x0, 0x0, 0x0, 0x0,
0x0, 0x1ad6850}, num_problems_defined = 3, blocks_to_analyze = 0x0,
analyze_subset = 0 '\0', redo_entry_and_exit = 0 '\0', def_info = {
refs = 0x0, begin = 0x1ab6108, count = 0x1ac15f8, refs_size = 0,
table_size = 0, total_size = 317, ref_order = DF_REF_ORDER_NO_TABLE},
use_info = {refs = 0x0, begin = 0x1ac1828, count = 0x1ac1a58,
refs_size = 0, table_size = 0, total_size = 191,
ref_order = DF_REF_ORDER_NO_TABLE}, def_regs = 0x1ab5a78,
use_regs = 0x1ab5ca8, eq_use_regs = 0x1ab5ed8, regs_size = 138,
regs_inited = 111, insns = 0x1ac1c88, insns_size = 212,
hardware_regs_used = 0x1abf620, regular_block_artificial_uses = 0x1abf630,
eh_block_artificial_uses = 0x1abf640, entry_block_defs = 0x1abf650,
exit_block_uses = 0x1abf660, insns_to_delete = 0x1aceb28,
insns_to_rescan = 0x1aceb38, insns_to_notes_rescan = 0x1aceb48,
postorder = 0x1ada900, postorder_inverted = 0x1ada940, n_blocks = 11,
n_blocks_inverted = 11, hard_regs_live_count = 0x1ab63e8, ref_order = 1846,
changeable_flags = 0}
(gdb) print df->problems_by_index[2]
$6 = (struct dataflow *) 0x0
(gdb)
Hmm, this looks like a dataflow bug to me. I believe the problem is that
DF_LIVE_OUT assumes/requires problems_by_index[DF_LIVE] to be non-NULL.
cheers,
DaveK
--
Can't think of a witty .sigline today....