This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PR c/7082
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com
- Date: Fri, 11 Oct 2002 22:37:58 +0200
- Subject: PR c/7082
Hi,
the testcase crashes because expand_mult is called with mode DImode and SImode
operand. I assume this is valid as it is for other expand functions, but it
fails because it calls copy_to_mode_reg on operand. I guess it will also
compute invalid results when all operations are done on shorter mode, so we
need to promote the mode before computing. I am surprised this didn't show up
earlier.
OK for mainline/3.2 branch?
Honza
Fri Oct 11 22:35:39 CEST 2002 Jan Hubicka <jh@suse.cz>
c/7082
* expmed.c (expand_mult): Promote input operand to the proper mode.
Index: expmed.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expmed.c,v
retrieving revision 1.124
diff -c -3 -p -r1.124 expmed.c
*** expmed.c 29 Sep 2002 18:25:20 -0000 1.124
--- expmed.c 11 Oct 2002 20:35:33 -0000
*************** expand_mult (mode, op0, op1, target, uns
*** 2412,2417 ****
--- 2412,2423 ----
enum machine_mode nmode;
op0 = protect_from_queue (op0, 0);
+ if (GET_MODE (op0) != mode)
+ op0 = convert_modes (mode,
+ GET_MODE (op0) != VOIDmode
+ ? GET_MODE (op0)
+ : mode,
+ op0, unsignedp);
/* Avoid referencing memory over and over.
For speed, but also for correctness when mem is volatile. */