Fix a use of int_range_max in phiopt that should be a type agnostic
range, because it could be either a pointer or an int.
PR tree-optimization/115191
gcc/ChangeLog:
* tree-ssa-phiopt.cc (value_replacement): Use Value_Range instead
of int_range_max.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr115191.c: New test.
--- /dev/null
+// { dg-do compile }
+// { dg-options "-O1 -w" }
+
+typedef void *SCM;
+void set_socket_io_ports();
+void STk_socket_accept(SCM line_buffered) {
+ if (!line_buffered)
+ line_buffered = (SCM)3;
+ set_socket_io_ports(line_buffered != 1);
+}
{
/* After the optimization PHI result can have value
which it couldn't have previously. */
- int_range_max r;
+ Value_Range r (TREE_TYPE (phires));
if (get_global_range_query ()->range_of_expr (r, phires,
phi))
{
- wide_int warg = wi::to_wide (carg);
- int_range<2> tmp (TREE_TYPE (carg), warg, warg);
+ Value_Range tmp (carg, carg);
r.union_ (tmp);
reset_flow_sensitive_info (phires);
set_range_info (phires, r);