public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/3712: abort in gen_umulsi3_highpart
@ 2001-07-17  9:26 Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2001-07-17  9:26 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3712
>Category:       optimization
>Synopsis:       abort in gen_umulsi3_highpart
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 17 09:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.1 20010717 (experimental)
>Organization:
>Environment:
System: Linux sykes 2.4.4-SMP #1 SMP Fri Jun 8 09:14:46 GMT 2001 ia64 unknown
Architecture: ia64

	
host: ia64-unknown-linux-gnu
build: ia64-unknown-linux-gnu
target: m68k-unknown-linux-gnu
configured with: /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as --disable-shared
>Description:
	Compiler is aborting in gen_umulsi3_highpart because
	const_uint32_operand returns false.  Looks like a sign extension
	bug, due to host being 64bit.  Offending rtx is (const_int
	-858993459 [0xffffffffcccccccd]).
>How-To-Repeat:
	$ cat x.i
	char *
	_itoa_word (unsigned long value, char *buflim,
		    unsigned int base, int upper_case)
	{
	  extern const char _itoa_upper_digits[], _itoa_lower_digits[];
	  const char *digits = upper_case ? _itoa_upper_digits : _itoa_lower_digits;
	  char *bp = buflim;

	  switch (base)
	    {
	      case 10: do *--bp = digits[value % 10]; while ((value /= 10) != 0); break;
	      case 16: do *--bp = digits[value % 16]; while ((value /= 16) != 0); break;
	      case 8: do *--bp = digits[value % 8]; while ((value /= 8) != 0); break;
	    default:
	      do
		*--bp = digits[value % base];
	      while ((value /= base) != 0);
	    }
	  return bp;
	}
	$ m68k-linux-gcc x.i -S -v
	Reading specs from /usr/local/m68k-linux/lib/gcc-lib/m68k-linux/3.1/specs
	Configured with: /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --enable-shared --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as : (reconfigured) /cvs/gcc/configure --target=m68k-linux --prefix=/usr/local/m68k-linux --enable-languages=c++ --with-ld=/usr/local/m68k-linux/m68k-linux/bin/ld --with-as=/usr/local/m68k-linux/m68k-linux/bin/as --disable-shared
	Thread model: single
	gcc version 3.1 20010717 (experimental)
	 /usr/local/m68k-linux/lib/gcc-lib/m68k-linux/3.1/cc1 -fpreprocessed x.i -quiet -dumpbase x.i -version -o x.s
	GNU CPP version 3.1 20010717 (experimental) (cpplib) (68k GNU/Linux with ELF)
	GNU C version 3.1 20010717 (experimental) (m68k-linux)
		compiled by GNU C version 2.96-ia64-000717 snap 001117.
	x.i: In function `_itoa_word':
	x.i:11: Internal compiler error in gen_umulsi3_highpart, at insn-emit.c:3021
	Please submit a full bug report,
	with preprocessed source if appropriate.
	See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: optimization/3712: abort in gen_umulsi3_highpart
@ 2001-07-22 21:51 rth
  0 siblings, 0 replies; 4+ messages in thread
From: rth @ 2001-07-22 21:51 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rth, schwab

Synopsis: abort in gen_umulsi3_highpart

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Sun Jul 22 21:51:07 2001
Responsible-Changed-Why:
    Mine.
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Sun Jul 22 21:51:07 2001
State-Changed-Why:
    Fixed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3712&database=gcc


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

* Re: optimization/3712: abort in gen_umulsi3_highpart
@ 2001-07-22 10:36 Andreas Schwab
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2001-07-22 10:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

The following reply was made to PR optimization/3712; it has been noted by GNATS.

From: Andreas Schwab <schwab@suse.de>
To: Richard Henderson <rth@redhat.com>
Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Subject: Re: optimization/3712: abort in gen_umulsi3_highpart
Date: 22 Jul 2001 19:28:08 +0200

 Richard Henderson <rth@redhat.com> writes:
 
 |> The m68k backend appears to be very confused on this issue.
 |> All constants are sign-extended.  Thus it makes no sense to
 |> ask whether an SImode operand is uint32.
 |> 
 |> It would matter when asking about a DImode operand, but that
 |> is not the case with umulsi3_highpart.
 
 Thanks, it works for me.
 
 Andreas.
 
 -- 
 Andreas Schwab                                  "And now for something
 SuSE Labs                                        completely different."
 Andreas.Schwab@suse.de
 SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
 Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5


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

* Re: optimization/3712: abort in gen_umulsi3_highpart
@ 2001-07-21 18:06 Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2001-07-21 18:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR optimization/3712; it has been noted by GNATS.

From: Richard Henderson <rth@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Subject: Re: optimization/3712: abort in gen_umulsi3_highpart
Date: Sat, 21 Jul 2001 17:57:56 -0700

 The m68k backend appears to be very confused on this issue.
 All constants are sign-extended.  Thus it makes no sense to
 ask whether an SImode operand is uint32.
 
 It would matter when asking about a DImode operand, but that
 is not the case with umulsi3_highpart.
 
 See if this works for you.
 
 
 r~
 
 
 	* m68k.c (const_uint32_operand): Abort if mode is <= 32 bits.
 	(const_sint32_operand): Likewise.
 	* m68k.md (anon mulsi pattern): Use const_int_operand not
 	const_sint32_operand.
 	(umulsi3_highpart): Zero extend a constant input.
 	(smulsi3_highpart): Don't bother checking SImode constant.
 	(const_umulsi3_highpart): Give op3 DImode.
 	(const_smulsi3_highpart): Likewise.
 
 Index: m68k.c
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/config/m68k/m68k.c,v
 retrieving revision 1.48
 diff -c -p -d -r1.48 m68k.c
 *** m68k.c	2001/07/17 06:54:45	1.48
 --- m68k.c	2001/07/22 00:52:14
 *************** strict_low_part_peephole_ok (mode, first
 *** 3937,3944 ****
   int
   const_uint32_operand (op, mode)
        rtx op;
 !      enum machine_mode mode ATTRIBUTE_UNUSED;
   {
   #if HOST_BITS_PER_WIDE_INT > 32
     /* All allowed constants will fit a CONST_INT.  */
     return (GET_CODE (op) == CONST_INT
 --- 3937,3949 ----
   int
   const_uint32_operand (op, mode)
        rtx op;
 !      enum machine_mode mode;
   {
 +   /* It doesn't make sense to ask this question with a mode that is
 +      not larger than 32 bits.  */
 +   if (GET_MODE_BITSIZE (mode) <= 32)
 +     abort ();
 + 
   #if HOST_BITS_PER_WIDE_INT > 32
     /* All allowed constants will fit a CONST_INT.  */
     return (GET_CODE (op) == CONST_INT
 *************** const_uint32_operand (op, mode)
 *** 3956,3963 ****
   int
   const_sint32_operand (op, mode)
        rtx op;
 !      enum machine_mode mode ATTRIBUTE_UNUSED;
   {
     /* All allowed constants will fit a CONST_INT.  */
     return (GET_CODE (op) == CONST_INT
   	  && (INTVAL (op) >= (-0x7fffffff - 1) && INTVAL (op) <= 0x7fffffff));
 --- 3961,3973 ----
   int
   const_sint32_operand (op, mode)
        rtx op;
 !      enum machine_mode mode;
   {
 +   /* It doesn't make sense to ask this question with a mode that is
 +      not larger than 32 bits.  */
 +   if (GET_MODE_BITSIZE (mode) <= 32)
 +     abort ();
 + 
     /* All allowed constants will fit a CONST_INT.  */
     return (GET_CODE (op) == CONST_INT
   	  && (INTVAL (op) >= (-0x7fffffff - 1) && INTVAL (op) <= 0x7fffffff));
 Index: m68k.md
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/config/m68k/m68k.md,v
 retrieving revision 1.42
 diff -c -p -d -r1.42 m68k.md
 *** m68k.md	2001/07/20 20:19:12	1.42
 --- m68k.md	2001/07/22 00:52:14
 ***************
 *** 3146,3152 ****
   (define_insn ""
     [(set (match_operand:SI 0 "register_operand" "=d")
   	(mult:SI (match_operand:SI 1 "register_operand" "%0")
 ! 		 (match_operand:SI 2 "const_sint32_operand" "")))
      (set (match_operand:SI 3 "register_operand" "=d")
   	(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
   					   (match_dup 2))
 --- 3146,3152 ----
   (define_insn ""
     [(set (match_operand:SI 0 "register_operand" "=d")
   	(mult:SI (match_operand:SI 1 "register_operand" "%0")
 ! 		 (match_operand:SI 2 "const_int_operand" "n")))
      (set (match_operand:SI 3 "register_operand" "=d")
   	(truncate:SI (lshiftrt:DI (mult:DI (sign_extend:DI (match_dup 1))
   					   (match_dup 2))
 ***************
 *** 3167,3177 ****
     "
   {
     operands[3] = gen_reg_rtx (SImode);
 !   if (GET_CODE (operands[2]) == CONST_INT
 !       || GET_CODE (operands[2]) == CONST_DOUBLE)
       {
 !       if (! const_uint32_operand (operands[2], VOIDmode))
 ! 	abort ();
         /* We have to adjust the operand order for the matching constraints.  */
         emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
   					     operands[1], operands[2]));
 --- 3167,3178 ----
     "
   {
     operands[3] = gen_reg_rtx (SImode);
 ! 
 !   if (GET_CODE (operands[2]) == CONST_INT)
       {
 !       operands[2] = immed_double_const (INTVAL (operands[2]) & 0xffffffff,
 ! 					0, DImode);
 ! 
         /* We have to adjust the operand order for the matching constraints.  */
         emit_insn (gen_const_umulsi3_highpart (operands[0], operands[3],
   					     operands[1], operands[2]));
 ***************
 *** 3195,3201 ****
   	(truncate:SI
   	 (lshiftrt:DI
   	  (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
 ! 		   (match_operand 3 "const_uint32_operand" ""))
   	  (const_int 32))))
      (clobber (match_operand:SI 1 "register_operand" "=d"))]
     "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
 --- 3196,3202 ----
   	(truncate:SI
   	 (lshiftrt:DI
   	  (mult:DI (zero_extend:DI (match_operand:SI 2 "register_operand" "1"))
 ! 		   (match_operand:DI 3 "const_uint32_operand" "n"))
   	  (const_int 32))))
      (clobber (match_operand:SI 1 "register_operand" "=d"))]
     "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
 ***************
 *** 3214,3224 ****
     "
   {
     operands[3] = gen_reg_rtx (SImode);
 !   if (GET_CODE (operands[2]) == CONST_INT
 !       || GET_CODE (operands[2]) == CONST_DOUBLE)
       {
 -       if (! const_sint32_operand (operands[2], VOIDmode))
 - 	abort ();
         /* We have to adjust the operand order for the matching constraints.  */
         emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
   					     operands[1], operands[2]));
 --- 3215,3222 ----
     "
   {
     operands[3] = gen_reg_rtx (SImode);
 !   if (GET_CODE (operands[2]) == CONST_INT)
       {
         /* We have to adjust the operand order for the matching constraints.  */
         emit_insn (gen_const_smulsi3_highpart (operands[0], operands[3],
   					     operands[1], operands[2]));
 ***************
 *** 3242,3248 ****
   	(truncate:SI
   	 (lshiftrt:DI
   	  (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
 ! 		   (match_operand 3 "const_sint32_operand" ""))
   	  (const_int 32))))
      (clobber (match_operand:SI 1 "register_operand" "=d"))]
     "TARGET_68020 && !TARGET_68060 && !TARGET_5200"
 --- 3240,3246 ----
   	(truncate:SI
   	 (lshiftrt:DI
   	  (mult:DI (sign_extend:DI (match_operand:SI 2 "register_operand" "1"))
 ! 		   (match_operand:DI 3 "const_sint32_operand" "n"))
   	  (const_int 32))))
      (clobber (match_operand:SI 1 "register_operand" "=d"))]
     "TARGET_68020 && !TARGET_68060 && !TARGET_5200"


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

end of thread, other threads:[~2001-07-22 21:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-17  9:26 optimization/3712: abort in gen_umulsi3_highpart Andreas Schwab
2001-07-21 18:06 Richard Henderson
2001-07-22 10:36 Andreas Schwab
2001-07-22 21:51 rth

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