[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2024-04-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

--- Comment #9 from Andrew Pinski  ---
*** Bug 46679 has been marked as a duplicate of this bug. ***

[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2024-04-02 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
   Target Milestone|--- |6.0

[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2015-08-25 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

Marek Polacek mpolacek at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |FIXED

--- Comment #8 from Marek Polacek mpolacek at gcc dot gnu.org ---
Assuming fixed then.


[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2015-07-26 Thread gary at intrepid dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

--- Comment #7 from Gary Funck gary at intrepid dot com ---
Don't know what the criteria is for closing bugs, but as far as I'm concerned,
this bug can be marked resolved and the other two referenced PR's marked as
duplicates of this one.  (They're against older rev's, so not sure if they're
exactly duplicates, but the chances of the fix being back-ported is probably
low.)


[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2015-07-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-07-24
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener rguenth at gcc dot gnu.org ---
The usual fix in fold-const.c is to make sure to convert operands to the
required type when building the final expression.  Thus instead of

10828   return fold_build2_loc (loc, EXACT_DIV_EXPR, type, arg0, arg1);

do

   return fold_build2_loc (loc, EXACT_DIV_EXPR, type,
   fold_convert (type, arg0), fold_convert (type,
arg1));

you can see this pattern in many places.

Care to post a patch?  It's pre-approved.


[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2015-07-24 Thread jay.krell at cornell dot edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

--- Comment #2 from Jay jay.krell at cornell dot edu ---
1 please be sure that dividing the most negative number by -1 works. 
Perhaps just don't optimize anything with negstive numbers.


2 I suggest that gcc's C/C++ frontends expose these other forms of division,
for the sake of testability.


Thank you,
 - Jay

On Jul 24, 2015, at 2:09 AM, rguenth at gcc dot gnu.org
gcc-bugzi...@gcc.gnu.org wrote:

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984
 
 Richard Biener rguenth at gcc dot gnu.org changed:
 
   What|Removed |Added
 
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-07-24
 Ever confirmed|0   |1
 
 --- Comment #1 from Richard Biener rguenth at gcc dot gnu.org ---
 The usual fix in fold-const.c is to make sure to convert operands to the
 required type when building the final expression.  Thus instead of
 
 10828   return fold_build2_loc (loc, EXACT_DIV_EXPR, type, arg0, 
 arg1);
 
 do
 
   return fold_build2_loc (loc, EXACT_DIV_EXPR, type,
   fold_convert (type, arg0), fold_convert (type,
 arg1));
 
 you can see this pattern in many places.
 
 Care to post a patch?  It's pre-approved.
 
 -- 
 You are receiving this mail because:
 You are on the CC list for the bug.


[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2015-07-24 Thread gary at intrepid dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

--- Comment #4 from Gary Funck gary at intrepid dot com ---
(In reply to Jay from comment #2)
 1 please be sure that dividing the most negative number by -1 works. 
 Perhaps just don't optimize anything with negstive numbers.

- Checking for negative numbers at compile-time can only be done on integer
constant values.

- Whether dividing the max negative number by -1 just works depends upon the
definition and implementation of FLOOR_DIV_EXPR.

- For UPC's use of FLOOR_DIV_EXPR, it isn't possible to construct that
scenario.


[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2015-07-24 Thread gfunck at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

--- Comment #6 from gfunck at gcc dot gnu.org ---
Author: gfunck
Date: Fri Jul 24 16:10:39 2015
New Revision: 226168

URL: https://gcc.gnu.org/viewcvs?rev=226168root=gccview=rev
Log:
2015-07-24  Gary Funck  g...@intrepid.com

PR middle-end/66984
* fold-const.c (fold_binary_loc): Call fold_convert on arguments to
fold_build2 for CEIL_DIV_EXPR and FLOOR_DIV_EXPR optimization.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c


[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2015-07-24 Thread gary at intrepid dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

--- Comment #5 from Gary Funck gary at intrepid dot com ---
(In reply to Jay from comment #2)
 2 I suggest that gcc's C/C++ frontends expose these other forms of division,
 for the sake of testability.

Perhaps defining a builtin for CEIL_DIV_EXPR and FLOOR_DIV_EXPR might work.

For the builtins, you could file an RFE and post a suggested patch (with test
cases) for review.


[Bug middle-end/66984] ICE: fold_binary changes type of operand, causing failure in verify_gimple_assign_binary

2015-07-24 Thread gary at intrepid dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66984

--- Comment #3 from Gary Funck gary at intrepid dot com ---
(In reply to Richard Biener from comment #1)
 The usual fix in fold-const.c is to make sure to convert operands to the
 required type when building the final expression.  Thus instead of
 
 10828   return fold_build2_loc (loc, EXACT_DIV_EXPR, type, arg0,
 arg1);
 
 do
 
return fold_build2_loc (loc, EXACT_DIV_EXPR, type,
fold_convert (type, arg0), fold_convert (type,
 arg1));
 
 you can see this pattern in many places.
 
 Care to post a patch?  It's pre-approved.

OK, I'll post a patch.  Thanks.