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

            Bug ID: 91389
           Summary: [7/8/9/10 Regression] error: control reaches end of
                    non-void function with -fsanitize=thread since r219201
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

Starting from the revision we generate a warning:

$ cat godot2.ii
class A {
  struct B {
    enum {} type;
  };
  B *m_fn1();
};
A::B *A::m_fn1() {
  B *a;
  switch (a->type) {
    break;
  default:
    return a;
  }
}

$ g++ -c godot2.ii  -c -Werror=return-type
$ g++ -c godot2.ii  -c -Werror=return-type -fsanitize=thread
godot2.ii: In member function ‘A::B* A::m_fn1()’:
godot2.ii:14:1: error: control reaches end of non-void function
[-Werror=return-type]
   14 | }
      | ^
cc1plus: some warnings being treated as errors

Can you Jakub please take a look?

Reply via email to