This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: validate_replace_rtx_1 fix


> Hi,
> 
> Let's hope this is now really the last bug preventing the m68k bootstrap.
Hope so too.
You seems to be having hard work.
> The problem is after the gcse pass this:
> 
> (insn 192 191 193 (set (reg:SI 63)
>         (minus:SI (const_int 3 [0x3])
>             (reg/v:SI 38))) 120 {subsi3} (nil)
>     (nil))
> 
> becomes this:
> 
> (insn 192 191 193 (set (reg:SI 63)
>         (plus:SI (const_double (const_int 0 [0x0]) -1 [0xffffffff] -1 [0xffffffff] 0 [0x0])
Hmm, SImode register, how the hell const_double gets created on it?

The const_double should be used only if the value does not fit to
HOST_WIDE_INT, that is at least 32bit, so there is smelling bug elsewhere.

Richard has recently applied patch to my constpool bypassing patch, that
may be real source, so I would suggest update and retry in case you
are not having it (it is in the simplify-rtx.c)

Otherwise, please investigate where the const_double is comming from first.
>             (const_int 3 [0x3]))) 98 {*addsi3_internal} (nil)
>     (nil))
> 
> (reg:SI 38) should actually be replaced with (const_int 1) in
> validate_replace_rtx_1, but op0_mode is wrong and the simplification
> fails.
> This bug actually miscompiles print_int_cst_octal in dbxout.c and causes
Thats the purpose I don't see misscomparisons - I am not using debugging
output on my target at all.
> wrong debugging output and this lets finally compare fail.
> I bootstrapped and tested it on linux-i686 and linux-m68k hopefully
> following tomorrow.
> 
> bye, Roman
> 
> 2001-07-28  Roman Zippel  <zippel@linux-m68k.org>
> 
> 	* recog.c (validate_replace_rtx_1): get mode from expression for
> 	constants
> 
> Index: recog.c
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/recog.c,v
> retrieving revision 1.116
> diff -u -r1.116 recog.c
> --- recog.c	2001/07/24 18:34:05	1.116
> +++ recog.c	2001/07/28 02:17:39
> @@ -450,8 +450,11 @@
> 
>    code = GET_CODE (x);
>    fmt = GET_RTX_FORMAT (code);
> -  if (fmt[0] == 'e')
> +  if (fmt[0] == 'e') {
>      op0_mode = GET_MODE (XEXP (x, 0));
> +    if (op0_mode == VOIDmode)
> +      op0_mode = GET_MODE (x);
> +  }
Hmm, this does not look correct to me.  Equivalent code is at different
places in compiler and they are not problematic.

Trick is, that the XEXP (x, 0) still should be the operand *before*
substitution (the register with proper mode) and I guess what happens is that
someone refuses to simplify the wrong const_double operand, keeping it around
and finally crash.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]