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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

  <bb 4> [local count: 1073741824]:
  # size_34 = PHI <[/app/example.cpp:123:12] 0(2), [/app/example.cpp:127:9]
size_35(3)>
  # DEBUG size => size_34
  [/app/example.cpp:126:29] # DEBUG BEGIN_STMT
  [/app/example.cpp:126:29] if (size_34 != 18446744073709551614)
    goto <bb 5>; [94.50%]
  else
    goto <bb 8>; [5.50%]
...

  <bb 8> [local count: 59055800]:
  [/app/example.cpp:132:12] _42 = "a" + 18446744073709551614;
  [/app/example.cpp:132:12] _43 = MEM[(const char *)"a" + -2B];



So it comes from:
    while (size < maxLength && str[size] != 0) {
        size++;
    }

Where maxLength is -2. We did a jump threading here. --coverage injects code
into the IR which then confuses the unroller and such for "a" being only 1 in
size.

uncommenting lines 124 and 130, stops the jump threading.
  • [Bug c++/120281] New: -Wa... dominick.allen1989 at gmail dot com via Gcc-bugs
    • [Bug tree-optimizati... pinskia at gcc dot gnu.org via Gcc-bugs

Reply via email to