richgel999 / jpeg-compressor

C++ JPEG compression/fuzzed low-RAM JPEG decompression codec with Public Domain or Apache 2.0 license
210 stars 57 forks source link

new "shifting a negative signed value is undefined" warning in clang 3.8svn #8

Closed ChristophHaag closed 4 years ago

ChristophHaag commented 8 years ago

They added a new warning: http://reviews.llvm.org/D10938

This line is affected: https://github.com/richgel999/jpeg-compressor/blob/fa962c9becd38c324064e9f4142721f749022a72/jpgd.cpp#L566

spjoe commented 8 years ago

also clang 7 is affected

clang --version
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
jpgd.cpp:569:51: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
        static const int s_extend_offset[16] = { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, ((-1...
                                                     ~~~~^
spjoe commented 8 years ago

can be resolved by applying the pull request #9

richgel999 commented 4 years ago

Fixed