public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: gcc@gcc.gnu.org
Subject: Reload bug
Date: Wed, 01 Sep 1999 08:40:00 -0000	[thread overview]
Message-ID: <jeyaeq4p4n.fsf@hawking.suse.de> (raw)

The following function generates a compiler crash in final:

$ cat random.c
unsigned int GetRandom (void);

long long
Default_RandInt (long long Max)
{
  long long f, m, r, a, b;
  long long s;

  do
    {
      m = Max;
      s = 0;
      f = 1;
      while (m > 1)
	{
	  if (m >= 4294967296)
	    r = GetRandom ();
	  else
	    {
	      a = 4294967296 - 4294967296 % m;
	      do
		b = GetRandom ();
	      while (!(b < a));
	      r = b % m;
	    }
	  s += r * f;
	  f = f * 4294967296;
	  m = (m - 1) / 4294967296 + 1;
	}
    }
  while (!(s < Max || Max == 0));

  return s;
}
$ b=/cvs/test/i686-linux/egcs/gcc; $b/xgcc -B$b/ -O2 -fpic -S random.c -da
random.c: In function `Default_RandInt':
random.c:34: Internal compiler error in `change_address', at emit-rtl.c:1516
Please submit a full bug report.
See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.

The problem is in the following two insns:

(insn 256 254 10 (set (reg:DI 31)
        (mem/u:DI (plus:SI (reg:SI 3 %ebx)
                (const (unspec[ 
                            (symbol_ref/u:SI ("*.LC0"))
                        ]  7))) 0)) 79 {movdi+1} (nil)
    (expr_list:REG_EQUIV (const_double (mem/u:DI (symbol_ref/u:SI ("*.LC0")) 0) 0 [0x0] 1 [0x1] 0 [0x0])
        (nil)))

(insn 83 77 85 (parallel[ 
            (set (reg/v:DI 26)
                (minus:DI (reg:DI 31)
                    (reg:DI 38)))
            (clobber (scratch:SI))
        ] ) 215 {subdi3} (insn_list 77 (nil))
    (expr_list:REG_DEAD (reg:DI 38)
        (expr_list:REG_UNUSED (scratch:SI)
            (nil))))

During global alloc register 31 is replaced by (mem:DI (symbol_ref)), but
a symbol_ref is not a valid memory operand due to PIC.  In other words,
register 31 is _not_ equivalent to what insn 256 claims.

-- 
Andreas Schwab                                  "And now for something
schwab@suse.de                                   completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

WARNING: multiple messages have this Message-ID
From: Andreas Schwab <schwab@suse.de>
To: gcc@gcc.gnu.org
Subject: Reload bug
Date: Thu, 30 Sep 1999 18:02:00 -0000	[thread overview]
Message-ID: <jeyaeq4p4n.fsf@hawking.suse.de> (raw)
Message-ID: <19990930180200.TNKzCnxPnIB2kHoyxQ7y-8m6t61jOfkOWAUZG58Mtm0@z> (raw)

The following function generates a compiler crash in final:

$ cat random.c
unsigned int GetRandom (void);

long long
Default_RandInt (long long Max)
{
  long long f, m, r, a, b;
  long long s;

  do
    {
      m = Max;
      s = 0;
      f = 1;
      while (m > 1)
	{
	  if (m >= 4294967296)
	    r = GetRandom ();
	  else
	    {
	      a = 4294967296 - 4294967296 % m;
	      do
		b = GetRandom ();
	      while (!(b < a));
	      r = b % m;
	    }
	  s += r * f;
	  f = f * 4294967296;
	  m = (m - 1) / 4294967296 + 1;
	}
    }
  while (!(s < Max || Max == 0));

  return s;
}
$ b=/cvs/test/i686-linux/egcs/gcc; $b/xgcc -B$b/ -O2 -fpic -S random.c -da
random.c: In function `Default_RandInt':
random.c:34: Internal compiler error in `change_address', at emit-rtl.c:1516
Please submit a full bug report.
See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.

The problem is in the following two insns:

(insn 256 254 10 (set (reg:DI 31)
        (mem/u:DI (plus:SI (reg:SI 3 %ebx)
                (const (unspec[ 
                            (symbol_ref/u:SI ("*.LC0"))
                        ]  7))) 0)) 79 {movdi+1} (nil)
    (expr_list:REG_EQUIV (const_double (mem/u:DI (symbol_ref/u:SI ("*.LC0")) 0) 0 [0x0] 1 [0x1] 0 [0x0])
        (nil)))

(insn 83 77 85 (parallel[ 
            (set (reg/v:DI 26)
                (minus:DI (reg:DI 31)
                    (reg:DI 38)))
            (clobber (scratch:SI))
        ] ) 215 {subdi3} (insn_list 77 (nil))
    (expr_list:REG_DEAD (reg:DI 38)
        (expr_list:REG_UNUSED (scratch:SI)
            (nil))))

During global alloc register 31 is replaced by (mem:DI (symbol_ref)), but
a symbol_ref is not a valid memory operand due to PIC.  In other words,
register 31 is _not_ equivalent to what insn 256 claims.

-- 
Andreas Schwab                                  "And now for something
schwab@suse.de                                   completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

             reply	other threads:[~1999-09-01  8:40 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-09-01  8:40 Andreas Schwab [this message]
1999-09-02  0:32 ` Jeffrey A Law
1999-09-02  2:15   ` Andreas Schwab
1999-09-30 18:02     ` Andreas Schwab
1999-09-30 18:02   ` Jeffrey A Law
1999-09-30 18:02 ` Andreas Schwab
2003-04-08 18:52 Eric Botcazou
2003-04-08 23:16 ` Jan Hubicka
2003-04-09  0:44   ` Jan Hubicka
2003-04-09  7:00     ` Eric Botcazou
2003-04-09  3:00   ` Eric Botcazou
2003-04-09  9:49     ` Jan Hubicka
2003-04-09  8:57   ` Eric Botcazou
2003-04-09  9:45     ` Jan Hubicka
2003-04-09  9:50       ` Eric Botcazou
2003-04-09 14:52         ` Jan Hubicka
2003-04-09 18:10           ` Eric Botcazou
2003-04-09 19:15             ` Jan Hubicka
2003-04-10 14:25           ` Eric Botcazou
2003-04-10 16:31             ` Jan Hubicka
2003-04-10 16:35               ` Jan Hubicka
2003-04-10 20:21             ` Eric Botcazou
2003-04-10 20:43               ` Jan Hubicka
2003-04-11 14:44                 ` Eric Botcazou
2003-04-11 17:49                   ` Jan Hubicka
2003-04-11 18:09                   ` Jan Hubicka
2003-04-11 19:01                   ` Jan Hubicka
2003-04-11 19:07                   ` Jan Hubicka
2003-04-12 14:55                     ` Eric Botcazou
2003-04-12 17:45                       ` Jan Hubicka
2003-04-13 19:57                         ` Eric Botcazou
2003-04-13 20:04                           ` Jan Hubicka
2003-04-10 20:51               ` Dale Johannesen
2003-04-09  9:13 ` Eric Botcazou
2003-04-09 11:25   ` Jan Hubicka
2003-04-09 12:04     ` Eric Botcazou
2003-04-09 18:05       ` Jan Hubicka
2003-04-09 18:26         ` Eric Botcazou
2003-04-09 21:23         ` Richard Henderson

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=jeyaeq4p4n.fsf@hawking.suse.de \
    --to=schwab@suse.de \
    --cc=gcc@gcc.gnu.org \
    /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).