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

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Another instance from Doom, this time where the enum is in a field lookup,
rather than an input parameter:

p_maputl.c: In function ‘P_BoxOnLineSide’:
p_maputl.c:151:8: warning: use of uninitialized value ‘p1’ [CWE-457]
[-Wanalyzer-use-of-uninitialized-value]
  151 |     if (p1 == p2)
      |        ^
  ‘P_BoxOnLineSide’: events 1-5
    |
    |  115 |     int         p1;
    |      |                 ^~
    |      |                 |
    |      |                 (1) region created on stack here
    |      |                 (2) capacity: 4 bytes
    |......
    |  118 |     switch (ld->slopetype)
    |      |     ~~~~~~       
    |      |     |
    |      |     (3) following ‘default:’ branch...
    |......
    |  151 |     if (p1 == p2)
    |      |        ~         
    |      |        |
    |      |        (4) ...to here
    |      |        (5) use of uninitialized value ‘p1’ here
    |

where r_defs.h has:

//
// Move clipping aid for LineDefs.
//
typedef enum
{
    ST_HORIZONTAL,
    ST_VERTICAL,
    ST_POSITIVE,
    ST_NEGATIVE

} slopetype_t;

typedef struct line_s
{
    [...snip...]

    // To aid move clipping.
    slopetype_t slopetype;

    [...snip...]
} line_t;

and all four enum values are covered by the switch statement.

Reply via email to