https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118862

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Yes.  Also, looking at that commit

+  /* Anything ** 0 is one.  */                                                 
+  if (tree_int_cst_sgn (rhs) == 0)                                             
+    {                                                                          
+      se->expr = build_int_cst (type, 1);                                      
+      return 1;                                                                
+    }                                                                          
+                                                                               
+  if (!wi::fits_shwi_p (wrhs))                                                 
+    return 0;                                                                  
+                                                                               
+  n = wrhs.to_uhwi ();                                                         

The first check should be integer_zerop (rhs) rather than tree_int_cst_sgn
(rhs) == 0.
And, then it checks if wrhs fits into shwi and uses it as uhwi, that means it
will ICE if wrhs is negative.  Either fits_uhwi_p + to_uhwi, or fits_shwi_p +
to_shwi, or just use wide_int.

Reply via email to