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

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
All memset come from ldist, so already quite late in the pipeline. Maybe
clang/intel, who avoid a comparison between new and the first memset, generate
memset directly from the front-end? (clang generates the first memset even at
-O0)

Even

  if(n<0)__builtin_unreachable();

doesn't quite solve the problem, because we don't realize that n==0 is the same
as (size_t)n==0 :-( (a mix of single_use restrictions, pass ordering, etc)

If I cheat and add

  if(n<=0)__builtin_unreachable();

surprisingly we fail to remove the first memset in

  n.0_11 = (sizetype) n_10(D);
  _14 = operator new [] (n.0_11);
  __builtin_memset (_14, 0, n.0_11);
  __builtin_memset (_14, 255, n.0_11);
  return _14;

I really thought we had code to do that...

Reply via email to