This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: types for VR_VARYING

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
 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

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

Any ideas?


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
0x815519 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*)
0x15e9391 value_range_base::type() const
0x16bdad6 vr_values::update_value_range(tree_node const*, value_range*)
0x200f9a9 evrp_range_analyzer::record_ranges_from_stmt(gimple*, bool)
0x14c9062 strlen_dom_walker::before_dom_children(basic_block_def*)
0x1fbdf8a dom_walker::walk(basic_block_def*)
0x14c9362 printf_strlen_execute
0x14c95f8 execute
Please submit a full bug report,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]