public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Carlo Wood <carlo@runaway.xs4all.nl>
To: egcs@cygnus.com
Cc: law@cygnus.com
Subject: Re: The "980505-1.c" bug (The Story Continued)
Date: Fri, 10 Jul 1998 23:00:00 -0000	[thread overview]
Message-ID: <199807110128.DAA16618@jolan.ppro> (raw)
In-Reply-To: <199807100056.CAA11845@jolan.ppro>

I wrote:

| The WEIRD result of adding this *uninitialized* register to the table is
| that reg_in_table[23] is incremented - without any other change:
| 
| reg_tick[23] == 0
| reg_in_table[23] == 0		<-- Just incremented by one

Woops. I concluded this from the comments at the start of cse.c,
but it should of course read:

  The WEIRD result of adding this *uninitialized* register to the table is
  that reg_in_table[23] is set to 0 - without any other change:
  
  reg_tick[23] == 0
  reg_in_table[23] == 0		<-- Just made equal to reg_tick[23]

---

The "libcall" case is just one of the many cases this can happen :/.
I think therefore that Jeffs patch (cvs diff -c3p -r1.39 -r1.40 cse.c)
is not sufficient for the whole family of bugs of this type.

reg_in_table[i] = reg_tick[i]  occurs at one single line in the code.
When I put the following in front of it:

if (reg_tick[i] == 0)
  abort();

then, with Jeffs patch added, "make check-gcc" fails for THOUSANDS of
test cases!  In other words: It is VERY commmon that an expression with
an uninitialized register is validated as having a meaningful value :/.

I am afraid that the only correct way to go is to tackle all different
cases seperately :/.  In the mean time the following "work around" works:

if (reg_tick[i] > 0)
  reg_in_table[i] = reg_tick[i];

instead of just "reg_in_table[i] = reg_tick[i]" thus.

The disadvantage of this is that it is possible to get less then optimal
optimisation.  But I suppose it doesn't happen that often that it makes a
difference ;) (because out of thousands, only one test case really resulted
in a bug; and I expect an equivalent percentage to get less well optimized).

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>

  parent reply	other threads:[~1998-07-10 23:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-07-09 19:08 Carlo Wood
1998-07-10 22:59 ` Jeffrey A Law
1998-07-10 23:00 ` Carlo Wood [this message]
1998-07-10 23:00   ` Jeffrey A Law
1998-07-11 12:10     ` Carlo Wood
1998-07-11  0:17 ` Jeffrey A Law

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=199807110128.DAA16618@jolan.ppro \
    --to=carlo@runaway.xs4all.nl \
    --cc=egcs@cygnus.com \
    --cc=law@cygnus.com \
    /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).