public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: powerpc-ibm-aix4.3.3.0 bootstrap issue
@ 2001-10-24 14:43 mike stump
  2001-10-24 14:48 ` Richard Henderson
  2001-10-25  2:43 ` Andreas Schwab
  0 siblings, 2 replies; 18+ messages in thread
From: mike stump @ 2001-10-24 14:43 UTC (permalink / raw)
  To: aoliva, grahams; +Cc: dje, gcc, john

> From: Alexandre Oliva <aoliva@redhat.com>
> Date: 24 Oct 2001 17:48:35 -0200

> But I still don't see how this would lead to bootstrap compare
> failures, or to differences not showing up when the compiler is run
> inside a debugger.

For much the same reason that:

main() {
       char *a[2];
       a[0]=strdup("Hi");
       a[1]=strdup("Hello");
       qsort (a, 2, sizeof(char*), strcmp);
       printf("%s\n", a[0]);
}

might print Hi, or Hello.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: powerpc-ibm-aix4.3.3.0 bootstrap issue
@ 2001-10-24 15:41 mike stump
  0 siblings, 0 replies; 18+ messages in thread
From: mike stump @ 2001-10-24 15:41 UTC (permalink / raw)
  To: rth; +Cc: aoliva, dje, gcc, grahams, john

> Date: Wed, 24 Oct 2001 14:48:05 -0700
> From: Richard Henderson <rth@redhat.com>
> To: mike stump <mrs@windriver.com>

> On Wed, Oct 24, 2001 at 02:42:59PM -0700, mike stump wrote:
> > > From: Alexandre Oliva <aoliva@redhat.com>
> > > Date: 24 Oct 2001 17:48:35 -0200
> > 
> > > But I still don't see how this would lead to bootstrap compare
> > > failures, or to differences not showing up when the compiler is run
> > > inside a debugger.
> > 
> > For much the same reason that:
> [...]
> > might print Hi, or Hello.

> No.  The important part is >>when .. run inside a debugger<<.

No, the important part is bootstrap failure...  That was the part I
was mainly answering.

> The important part is >>when .. run inside a debugger<<.

bootstrap failures are in some ways, more important that differing
results in gdb.

> Nothing should change when run inside a debugger except timing, and
> gcc is not timing sensitive.

I agree, in a perfect world, this is the case.  However, if gcc ever
has a bug (and sometimes, it does), say, something like:

$ cat t5.c
main() {
       char *a[2];
       printf("%d\n", a);
       a[0]=strdup("Hi");
       a[1]=strdup("Hello");
       qsort (a, 2, sizeof(char*), strcmp);
       printf("%s\n", a[0]);
}

$ a.out
-4264688
Hi.

$ gdb a.out
GNU gdb 4.18
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-sun-solaris2.5.1"...

NAT>run
Starting program: /tmp/a.out
-4264680

then the behavior _can_ be dependent on such things.  We _can_ agree
that nothing in gcc should be sensitive to these things.  I was
answering the question of what to watch out for and _how_ it could
possibly be the case, _given_ that it happens.

^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <4168092C-B9D3-11D5-8895-003065C86F94@apple.com>]
* Re: powerpc-ibm-aix4.3.3.0 bootstrap issue
@ 2001-10-05 11:30 mike stump
  2001-10-05 11:46 ` David Edelsohn
  0 siblings, 1 reply; 18+ messages in thread
From: mike stump @ 2001-10-05 11:30 UTC (permalink / raw)
  To: dje; +Cc: gcc, john

> To: mike stump <mrs@windriver.com>
> cc: john@feith.com, gcc@gcc.gnu.org
> Date: Thu, 04 Oct 2001 23:00:53 -0400
> From: David Edelsohn <dje@watson.ibm.com>

> 	Using a debugger on the compiler producing different output caused
> the compiler to stop emitting different output.  Debugging the compiler
> affected the problem, which is why I think this is a memory layout, memory
> corruption, or memory address issue.

> 	I and others tried debugging tricks #1 through #MAX_INT.  It's not
> that simple.

Standard debugging trick #136 would be to take the .ii file you know
can produce different output, and the date stamp for the compiler, and
have everyone with two or more possible environments update to that
time, build up the same compiler in all possible environments they
can, and then to see which versions of the output they get, and have
people try debug it, and see if we can't find a person with two
environments that yield different outputs that they can debug in.

For example, if one has a cygwin hosted compiler, and a solaris
compiler, one can see if they match, or are different.  Also, by
surveying it, we can deduce things about the environment that is
special.  If it is just gcc-2.95.x that miscompiles reload, then we
can put in the instructions, please compile up, non-bootstrap with a
new tool chain, and then recompile using bootstrap the compiler with
itself...  in this special case.  This sort of advice, is slightly
better than just using -O1, or hacking reload to be somehow different.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: powerpc-ibm-aix4.3.3.0 bootstrap issue
@ 2001-10-04 19:48 mike stump
  2001-10-04 20:00 ` David Edelsohn
  0 siblings, 1 reply; 18+ messages in thread
From: mike stump @ 2001-10-04 19:48 UTC (permalink / raw)
  To: dje, john; +Cc: gcc

> 	I have been unable to cleanly bootstrap GCC on the trunk since the
> HOST_WIDE_INT use of "long long" change.

> 	I would appreciate any help in trying to track this down as I am
> not having much luck.

First, isolate the .i (or .ii file) that differs in the assembly
output.  Then, isolate the two compilers that produce this.

From there, you can put a printf in routines that are heavily used,
and print out something that doesn't change about them INSN_UUID,
__func__, lineno... from compile to compile (not addresses of rtx
structures).  Run, and see if the .s output is still failing.  If it
is, you can then run diff on the debugging output (can be easier to do
this with diff, then doing it in on online session in gdb).  At the
first difference, you work in more prints between the last one that
worked and the current one.

Or, do this in an online way with two gdb's running side by side.  Run
with -da, find first difference, break on gen_rtx or add_insn or one
of those...  Go up a level, set a break point on calling site, rerun
to that temporal instance.  I usually binary search with cont 50, cont
100, cont 200, or, cont 25, cont 13, cont 7...  then step into the
routine, watching for the different.  In a large complex function,
binary searching with next 20, next 40 and so on, until you find a
difference is fairly quick.  And then you repeat.

After doing this for a day, it becomes easier and more automatic.
Also, you learn to slant the binary seach to favor running for a
shorter period of time, instead of in the middle, as if you miss it,
it takes more time and energy to get back to the right temporal spot.


This is standard debugging trick #135.  Now, if only I could find the
web pages that describes it in all is glory detail.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: powerpc-ibm-aix4.3.3.0 bootstrap issue
@ 2001-10-04 18:48 mike stump
  0 siblings, 0 replies; 18+ messages in thread
From: mike stump @ 2001-10-04 18:48 UTC (permalink / raw)
  To: gcc, john

> Date: Thu, 4 Oct 2001 20:58:17 -0400 (EDT)
> From: John Wehle <john@feith.com>
> To: gcc@gcc.gnu.org

> This platform has failed to bootstrap here for some time due to
> bootstrap comparison errors.

:-(

> I did some digging and generated a testcase for which the native
> (stage1) cc1 reload pass generates different rtl than a cross
> compiler.

The preference would be to actually find someone that can track down
the difference all the way, using the testcase you've already found,
and actually fix the real problem.  I'd tend to guess that there is
actually a subtle non-portability issue.

^ permalink raw reply	[flat|nested] 18+ messages in thread
* powerpc-ibm-aix4.3.3.0 bootstrap issue
@ 2001-10-04 17:58 John Wehle
  2001-10-04 19:25 ` David Edelsohn
  0 siblings, 1 reply; 18+ messages in thread
From: John Wehle @ 2001-10-04 17:58 UTC (permalink / raw)
  To: gcc

This platform has failed to bootstrap here for some time due to bootstrap
comparison errors.  I did some digging and generated a testcase for which
the native (stage1) cc1 reload pass generates different rtl than a cross
compiler.  At a quick glance the differences seem to be related to whether
a reload comes from another register or from memory.  If I simply recompile
reload.o using -O2 than the native cc1 generates the same code as the cross
compiler.  I'm about to try bootstrapping the compiler using -O2.

It sounds like reload.c is being miscompiled by the installed compiler
(in this case gcc 2.95.3).  Do we want to hack reload.c so that bootstrapping
using gcc 2.95.3 works, or simply document that -O2 is required (assuming
I have success)?

-- John
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2001-10-25  2:43 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-24 14:43 powerpc-ibm-aix4.3.3.0 bootstrap issue mike stump
2001-10-24 14:48 ` Richard Henderson
2001-10-24 15:00   ` David Edelsohn
2001-10-24 16:20     ` Richard Henderson
2001-10-24 17:14       ` David Edelsohn
2001-10-25  2:43 ` Andreas Schwab
  -- strict thread matches above, loose matches on Subject: below --
2001-10-24 15:41 mike stump
     [not found] <4168092C-B9D3-11D5-8895-003065C86F94@apple.com>
2001-10-05 21:36 ` David Edelsohn
2001-10-05 11:30 mike stump
2001-10-05 11:46 ` David Edelsohn
2001-10-04 19:48 mike stump
2001-10-04 20:00 ` David Edelsohn
2001-10-23  8:34   ` Alexandre Oliva
2001-10-23  9:40     ` Graham Stott
2001-10-24 12:48       ` Alexandre Oliva
2001-10-04 18:48 mike stump
2001-10-04 17:58 John Wehle
2001-10-04 19:25 ` David Edelsohn

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).