This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug middle-end/86140] New: constprop clones with identical bodies


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

            Bug ID: 86140
           Summary: constprop clones with identical bodies
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redbeard0531 at gmail dot com
  Target Milestone: ---

This was tweaked example code to demonstrate something totally unrelated, but I
noticed it was doing the constprop clone thing for functions with identical
instructions, which seemed odd. While this exact case doesn't matter, it seemed
like it might be a sign of a deeper bug.

https://godbolt.org/g/Zwpi7J

[[gnu::noinline]] void f(const int*){
    asm volatile("");
}

void good() {
    constexpr static int arr[1000] = {};
    f(arr);
}

void bad() {
    constexpr  int arr[1000] = {};
    f(arr);
}


f(int const*) [clone .constprop.0]:
  ret
f(int const*) [clone .constprop.1]:
  ret
f(int const*):
  ret
good():
  jmp f(int const*) [clone .constprop.0]
bad():
  jmp f(int const*) [clone .constprop.1]

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