This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rtlopt] "variable tracking" pass


On Tuesday, January 14, 2003, at 04:59  PM, Josef Zlomek wrote:

The file which fails is from libstdc++-v3/libsupc++/
(it is being compiled after the final compiler is built).
I think it is eh_globals.cc but I'm not sure.

Yeah, i reproduced it.
Thanks.
It's a fun bug exposed by the interaction of -ffunction-sections and
global variables.

Simple fix, however:
change

+         if (separate_line_info_table_in_use == 0)
+           endname = text_end_label;
+         else
to

+         if (separate_line_info_table_in_use == 0 ||
!current_function_decl)
+           endname = text_end_label;
+         else

in the patch.

I'm bootstrapping now to see if there are any further problems.
It should at least avoid the segfault :-)
I was not sure what does the code mean so I did not want to write such
a fix myself.
It's actually buggy, but the goal is was to determine the label for the end of the code for this function (so we can say where the last part of the range is valid to).

I actually meant to write something like

if (!current_function_decl)
endname = text_end_label;
else
...

That way, we say ranges for globals are valid during all code, and otherwise, it's valid to the end of the function (which is what the other arm of the if is doing).

There's also a reversed strcmp test i swear i fixed:
if (strcmp (curr->section, ".text") == 0)
{
/* dw2_asm_output_data will mask off any extra bits in the ~0. */
dw2_asm_output_data (DWARF2_ADDR_SIZE, ~(unsigned HOST_WIDE_INT) 0,
"Location list base address specifier fake entry");
dw2_asm_output_offset (DWARF2_ADDR_SIZE, curr->section,
"Location list base address specifier base");
}
should be
if (strcmp (curr->section, ".text") != 0)
{
/* dw2_asm_output_data will mask off any extra bits in the ~0. */
dw2_asm_output_data (DWARF2_ADDR_SIZE, ~(unsigned HOST_WIDE_INT) 0,
"Location list base address specifier fake entry");
dw2_asm_output_offset (DWARF2_ADDR_SIZE, curr->section,
"Location list base address specifier base");
}


I wrote the debug output code over the course of about 30 minutes (seriously, i didn't spend more than 30 minutes writing it originally) while half paying attention to a CS class, so it's not very cleanly written.

I'll rewrite it so it's understandable, and not so ugly.


Thank you!

Josef






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]