This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/49472] [4.7 regression] Compiler segfault on valid code
- From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 21 Jun 2011 08:32:48 +0000
- Subject: [Bug rtl-optimization/49472] [4.7 regression] Compiler segfault on valid code
- Auto-submitted: auto-generated
- References: <bug-49472-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49472
--- Comment #10 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-06-21 08:31:22 UTC ---
> --- gcc/simplify-rtx.c.jj 2011-06-08 08:53:15.000000000 +0200
> +++ gcc/simplify-rtx.c 2011-06-21 09:46:27.000000000 +0200
> @@ -686,13 +686,13 @@ simplify_unary_operation_1 (enum rtx_cod
> return simplify_gen_binary (MINUS, mode, temp, XEXP (op, 1));
> }
>
> - /* (neg (mult A B)) becomes (mult (neg A) B).
> + /* (neg (mult A B)) becomes (mult A (neg B)).
> This works even for floating-point values. */
> if (GET_CODE (op) == MULT
> && !HONOR_SIGN_DEPENDENT_ROUNDING (mode))
> {
> - temp = simplify_gen_unary (NEG, mode, XEXP (op, 0), mode);
> - return simplify_gen_binary (MULT, mode, temp, XEXP (op, 1));
> + temp = simplify_gen_unary (NEG, mode, XEXP (op, 1), mode);
> + return simplify_gen_binary (MULT, mode, XEXP (op, 0), temp);
> }
>
> /* NEG commutes with ASHIFT since it is multiplication. Only do
>
> stops the moving of the operands around, with this it keeps being called with
> the same operands again and again, but still an endless recursion. Eric, any
> preferences where to prevent this from happening?
ISTM that pursuing in the above way, according to swap_commutative_operands_p,
is a sensible approach, so I'd remove the simplify_binary_operation_1 bits.