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

            Bug ID: 81212
           Summary: -Wreturn-type is disabled when used together with
                    -fsanitize=return
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vanyacpp at gmail dot com
  Target Milestone: ---

Consider this code snippet:

struct X
{
    X(void* p);

    void* p;
};


X f(bool x, void* p)
{
    if (x)
        return X(p);
}

Compiling it with gcc 7.1 -Wreturn-type gives a warning:
warning: control reaches end of non-void function [-Wreturn-type]

But compiling it with gcc 7.1 -Wreturn-type and -fsanitize=return gives no
warning. Clang 4.0 gives the warning in both cases. It would be great if gcc
gave the warning in both cases too.

Reply via email to