public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ian Lance Taylor <iant@google.com>
To: Matt <matt@use.net>
Cc: gcc-help@gcc.gnu.org
Subject: Re: bootstrap comparison failure with bootstrap-lto
Date: Sun, 20 Nov 2011 07:32:00 -0000	[thread overview]
Message-ID: <mcrr513i8xg.fsf@dhcp-172-18-216-180.mtv.corp.google.com> (raw)
In-Reply-To: <Pine.NEB.4.64.1111191638350.15450@cesium.clock.org>	(matt@use.net's message of "Sat, 19 Nov 2011 16:48:19 -0800 (PST)")

Matt <matt@use.net> writes:

>> Great.  I think that now we've cleared through the weeds and gotten to
>> the interesting part: why does it crash?  I think the failing test is
>> gcc_AC_INITFINI_ARRAY in gcc/acinclude.m4.  It is intended to see
>> whether the host linker correctly supports a mix of .init_array and
>> .ctors sections with priorities.  This test is intended to be more or
>> less independent of the compiler, and is intended to only test the
>> linker.  Both the host gcc used to build stage1 and the stage1 gcc
>> itself are presumably using the same linker (right?).  So, why would the
>> test pass with the host gcc and fail with the stage1 gcc?
>>
>> If you can trace the points at which the static variable "count"
>> changes, that may help us pin down what is going wrong.
>
> Pin down, indeed :) When I try to watch or print 'count', I get this
> from GDB:
> Reading symbols from /home/matt/src/gcc-trunk/obj/conftest...done.
> (gdb) watch count
> Watchpoint 1: count
> (gdb) run
> Starting program: /home/matt/src/gcc-trunk/obj/conftest
> Error evaluating expression for watchpoint 1
> value has been optimized out
> Watchpoint 1 deleted.
>
> So, it looks like an optimization bug of a sort to my naive eyes.

It more likely is a problem with the generating of debug info for
optimized code, rather than an optimization bug per se.  It's fairly
normal to have problem running the debugger on optimized code.

> As
> such, I started trying different combinations on the compile line, the
> original was:
> /home/matt/src/gcc-trunk/obj/./prev-gcc/xgcc
> -B/home/matt/src/gcc-trunk/obj/./prev-gcc/
> -B/home/matt/x86_64-unknown-linux-gnu/bin/
> -B/home/matt/x86_64-unknown-linux-gnu/bin/
> -B/home/matt/x86_64-unknown-linux-gnu/lib/ -isystem
> /home/matt/x86_64-unknown-linux-gnu/include -isystem
> /home/matt/x86_64-unknown-linux-gnu/sys-include  -o conftest -g -O2
> -flto=jobserver -frandom-seed=1  -static-libstdc++ -static-libgcc
> ~/finitest.c
>
>
> If I take out the -flto=jobserver, the test no longer crashes and the
> variable is no longer optimized out incorrectly. Trying other -flto
> variants all elicited the original problem. When I tested compilation
> using the trunk *or* the system compiler (GCC 4.6.1-based) with -O2
> -flto, I was able to repeat the problem exactly.
>
> Is this a wrong-code bug, and/or should that test never be compiled
> with -flto?

That's interesting.  Where did the -flto=jobserver option come from?
Did you add that?

Looking at this, I think that this kind of test is going to fail when
using -flto and gold, because gold is going to report that the symbols
listed in the .ctors and .init_array sections are not visible from the
outside.  Unfortunately this is not simple to fix in gold.  In fact, I'm
not sure it's possible in the general case.

Ian

  reply	other threads:[~2011-11-20  6:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14 22:23 Matt
2011-11-15  5:56 ` Ian Lance Taylor
2011-11-16 21:55   ` Matt
2011-11-17  5:43     ` Ian Lance Taylor
2011-11-18  6:35       ` Matt
2011-11-18 13:47         ` Ian Lance Taylor
2011-11-18 21:08           ` Matt
2011-11-19  1:11             ` Ian Lance Taylor
2011-11-19  2:41               ` Matt
2011-11-19 15:37                 ` Ian Lance Taylor
2011-11-20  6:51                   ` Matt
2011-11-20  7:32                     ` Ian Lance Taylor [this message]
2011-11-20 20:23                       ` Matt Hargett
2011-11-21 17:27                         ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mcrr513i8xg.fsf@dhcp-172-18-216-180.mtv.corp.google.com \
    --to=iant@google.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=matt@use.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).