Skip to content

shifting a negative signed value is undefined ("-1L << 16" in inflate.c) #183

@cliffordwolf

Description

@cliffordwolf

inflate.c triggers the following warning in clang version 3.8.0-2ubuntu4:

inflate.c:1507:61: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
                                                        ~~~ ^

I believe ~0UL << 16 has defined behavior and yields the expected result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions