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

            Bug ID: 79677
           Summary: Weird handling of -Werror=
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

On the following testcase:

int
main()
{
  char message[10] = "";
  __builtin_printf(message);
  return 0;
}

we warn (or error) e.g. with:
-Wformat -Wformat-security
-Wformat -Werror=format-security
-Wall -Wformat-security
-Wall -Werror=format-security
-Wformat -Wformat-security -Wformat
-Wall -Wformat-security -Wformat
-Wformat -Wformat-security -Wall
-Wall -Wformat-security -Wall
-Wformat -Wformat-security -Werror=format-security -Wformat
-Wall -Wformat-security -Werror=format-security -Wformat
-Wformat -Wformat-security -Werror=format-security -Wall
-Wall -Wformat-security -Werror=format-security -Wall
but not with:
-Wformat -Werror=format-security -Wformat
-Wall -Werror=format-security -Wformat
-Wformat -Werror=format-security -Wall
-Wall -Werror=format-security -Wall

-Wall implies -Wformat (level 1) and -Wformat only for level 2 implies
-Wformat-security, so something in the -Wformat or -Wall handling disables
warn_format_security, but strangely only when the -Werror option is used.

Reply via email to