Undefined behaviour in python .cc module? #82

Closed
opened 2026-01-29 20:32:11 +00:00 by claunia · 2 comments
Owner

Originally created by @mmastrac on GitHub (Dec 26, 2015).

When compiling on OSX, I get this:

python/brotlimodule.cc:131:12: warning: comparison of constant -1 with expression of type 'BrotliParams::Mode' is always true
      [-Wtautological-constant-out-of-range-compare]

I suspect the cast of the out-of-range -1 to an enum is undefined behaviour in C++, but I'm not certain.

Originally created by @mmastrac on GitHub (Dec 26, 2015). When compiling on OSX, I get this: ``` python/brotlimodule.cc:131:12: warning: comparison of constant -1 with expression of type 'BrotliParams::Mode' is always true [-Wtautological-constant-out-of-range-compare] ``` I suspect the cast of the out-of-range -1 to an enum is undefined behaviour in C++, but I'm not certain.
Author
Owner

@anthrotype commented on GitHub (Dec 26, 2015):

cc @khaledhosny

@anthrotype commented on GitHub (Dec 26, 2015): cc @khaledhosny
Author
Owner

@eustas commented on GitHub (Jan 18, 2016):

Hello, Matt.

Thank you for your report. Could you check if casting mote to int in python/brotlimodule.cc:131 fixes the problem?

Best regards,
Eugene.

@eustas commented on GitHub (Jan 18, 2016): Hello, Matt. Thank you for your report. Could you check if casting mote to int in python/brotlimodule.cc:131 fixes the problem? Best regards, Eugene.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#82