On 8/15/19 10:06 AM, Aldy Hernandez wrote:


Hey Aldy,

After enabling EVRP for the strlen pass (as part of the sprintf
integration) I get a SEGV in the return statement in the function
below.  Backing out this change gets rid of the ICE and lets my
tests pass, but I have no idea what the root cause of the SEGV
might be.  The only mildly suspicious thing is the assertion in
the function:

@@ -355,9 +369,7 @@ value_range_base::singleton_p (tree *result) const
 tree
 value_range_base::type () const
 {
-  /* Types are only valid for VR_RANGE and VR_ANTI_RANGE, which are
-     known to have non-zero min/max.  */
-  gcc_assert (min ());
+  gcc_assert (m_min || undefined_p ());
   return TREE_TYPE (min ());
 }

*this looks like so:

  (gdb) p *this
  $55 = {m_kind = VR_UNDEFINED, m_min = 0x0, m_max = 0x0}

so the assertion passes but the dererefence in TREE_TYPE fails.

The test case is trivial:

  void g (const char *a, const char *b)
  {
    if (__builtin_memcmp (a, b, 8))
      __builtin_abort ();
  }

The ICE happens when updating the range for the second statement
below:

  _1 = __builtin_memcmp (a_3(D), b_4(D), 8);
  _1 = (int) _8;

Any ideas?

Martin


during GIMPLE pass: strlen
u.c: In function ā€˜gā€™:
u.c:1:6: internal compiler error: Segmentation fault
    1 | void g (const char *a, const char *b)
      |      ^
0x11c4d08 crash_signal
        /src/gcc/svn/gcc/toplev.c:326
0x815519 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
        /src/gcc/svn/gcc/tree.h:3376
0x15e9391 value_range_base::type() const
        /src/gcc/svn/gcc/tree-vrp.c:373
0x16bdad6 vr_values::update_value_range(tree_node const*, value_range*)
        /src/gcc/svn/gcc/vr-values.c:237
0x200f9a9 evrp_range_analyzer::record_ranges_from_stmt(gimple*, bool)
        /src/gcc/svn/gcc/gimple-ssa-evrp-analyze.c:325
0x14c9062 strlen_dom_walker::before_dom_children(basic_block_def*)
        /src/gcc/svn/gcc/tree-ssa-strlen.c:4800
0x1fbdf8a dom_walker::walk(basic_block_def*)
        /src/gcc/svn/gcc/domwalk.c:309
0x14c9362 printf_strlen_execute
        /src/gcc/svn/gcc/tree-ssa-strlen.c:4866
0x14c95f8 execute
        /src/gcc/svn/gcc/tree-ssa-strlen.c:4968
Please submit a full bug report,

Reply via email to