Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning: left shift count >= width of type #4

Closed
raul-klg opened this issue May 8, 2019 · 3 comments
Closed

warning: left shift count >= width of type #4

raul-klg opened this issue May 8, 2019 · 3 comments

Comments

@raul-klg
Copy link

raul-klg commented May 8, 2019

Hello:
After fixing #3 (thanks for that), I'm now noticing the subject warning:

../../../inc/CRC.h:753:52: warning: left shift count >= width of type [-Wshift-count-overflow]
         remainder = static_cast<CRCType>(remainder << SHIFT);

In order to reproduce I clone and update to HEAD (7421f32). I then go to test/prj/gcc and finally I issue make.
I'm on debian stretch and gcc version is:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-18+deb9u1' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)

build.log

d-bahr added a commit that referenced this issue May 8, 2019
Fix issue #4. Removed BoundedConstexprValue function and inlined it since GCC 6 seems to handle constexpr differently than GCC 7.
d-bahr added a commit that referenced this issue May 8, 2019
Fix issue #4. Apparently GCC 6 handles constexpr differently than GCC7, so BoundedConstexprValue was removed and inlined.
@d-bahr
Copy link
Owner

d-bahr commented May 8, 2019

Weird, this only happens with GCC 6, but GCC 7 compiles without errors. The BoundedConstexprValue function should trap these errors, but maybe there's something odd with how GCC 6 handles constexpr functions.

Try HEAD now (534c1d8) and let me know if you still have any issues.

@d-bahr
Copy link
Owner

d-bahr commented May 8, 2019

Note to self, this probably should be fixed by properly supporting SFINAE but getting cross-compilation support with SFINAE is probably pretty painful.

@d-bahr
Copy link
Owner

d-bahr commented Jan 26, 2020

Ticket has been idle for a while, a fix has been committed, so I'm going to close this issue.

@d-bahr d-bahr closed this as completed Jan 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants