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

            Bug ID: 77699
           Summary: suspicious code in get_next_line
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bernd.edlinger at hotmail dot de
  Target Milestone: ---

Hi,

this is also suspicious by -Wint-in-bool-context warning:

../../gcc-trunk/gcc/input.c: In function 'bool get_next_line(fcache*, char**,
ssize_t*)':
../../gcc-trunk/gcc/input.c:537:13: error: using integer constants in boolean
context [-Werror=int-in-bool-context]
     return -1;
             ^


code here does:

  if (ferror (c->fp))
    return -1;


but -1 is converted to bool, the return type of get_next_line,

so caller will assume valid data, while we really had I/O error.

Reply via email to