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

            Bug ID: 85094
           Summary: -g with any optimization suppresses
                    -Wduplicated-branches
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sirl at gcc dot gnu.org
  Target Milestone: ---

This small testcase doesn't warn if compiled with -g and -O1 or higher. Only
"-g -O0" or for example -O2 without -g warn for the testcase. This is trunk at
r258870. gcc-7 warns as expected.

extern int g;

void f(int r)
{
  if (r < 64)
    g -= 48;
  else if (r < 80)
    g -= 64 - 45;
  else
    g -= 80 - 61;
}

Reply via email to