Skip to content

undefined behavior sanitizer dislikes (1 << 31) #153

@bhaller

Description

@bhaller

UndefinedBehaviorSanitizer complains:

kastore.c:654:46: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

The relevant line:

if (self->file != NULL && (self->flags & OWN_FILE)) {

The relevant define:

#define OWN_FILE (1 << 31)

The 1 here should be unsigned, I guess, or a shift of less than 31 should be used. I didn't realize that this was undefined behavior in C, but apparently it is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions