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

            Bug ID: 97657
           Summary: libsanitizer/sanitizer_common/sanitizer_posix.cpp:162:
                    no code to deal with bad mode ?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
                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: ---

libsanitizer/sanitizer_common/sanitizer_posix.cpp:162:27: warning: ‘flags’ may
be used uninitialized in this function [-Wmaybe-uninitialized]

Source code is

  int flags;
  switch (mode) {
    case RdOnly: flags = O_RDONLY; break;
    case WrOnly: flags = O_WRONLY | O_CREAT | O_TRUNC; break;
    case RdWr: flags = O_RDWR | O_CREAT; break;
  }
  fd_t res = internal_open(filename, flags, 0660);

There is no code to deal with an unexpected value of mode.

Reply via email to