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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-06-25
            Version|unknown                     |9.0
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We already insert GIMPLE_RETURNs (just with no value...) during the GIMPLE
lowering phase.  Not sure how difficult/good it were to change those to
calls to __builtin_trap() (or make them at least IL "consistent" and return
an uninitialized thing).

That is, starting with .008.lower we have

test ()
{
  volatile int i;

  i = 0;
  return;
}

which looks suspicious.  That's where we could improve.

  /* If the function falls off the end, we need a null return statement.
     If we've already got one in the return_statements vector, we don't
     need to do anything special.  Otherwise build one by hand.  */
  bool may_fallthru = gimple_seq_may_fallthru (lowered_body);
  if (may_fallthru
      && (data.return_statements.is_empty ()
          || (gimple_return_retval (data.return_statements.last().stmt)
              != NULL)))
    {
      x = gimple_build_return (NULL);
      gimple_set_location (x, cfun->function_end_locus);
      gimple_set_block (x, DECL_INITIAL (current_function_decl));
      gsi_insert_after (&i, x, GSI_CONTINUE_LINKING);
      may_fallthru = false;
    }

Nowadays we can have SSA names in this IL state so

  return dummy_2(D);

would do.

Reply via email to