]> git.ipfire.org Git - thirdparty/gcc.git/commit
Avoid undefined shifts in ceil2 operations
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Aug 2018 15:07:35 +0000 (15:07 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Aug 2018 15:07:35 +0000 (15:07 +0000)
commitfe92dce78eb90b5bab6b2f865f8e746170075677
tree111035d748bf025dcc5d4a417edde0802112332d
parentabf0dec5ba26def728a8023d2b22e8859d0bf0aa
Avoid undefined shifts in ceil2 operations

For values where the result cannot be represented the shift width would
be equal to the width of the type, which is undefined. Perform two
well-defined shifts instead of one possible undefined shift.

* include/bits/hashtable_policy.h (__clp2): Fix calculation for LLP64
targets where sizeof(size_t) > sizeof(long). Avoid undefined shifts
of the number of bits in the type.
* include/std/bit (__ceil2): Avoid undefined shifts.
* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Test values with
the most signifiant bit set.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263986 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/hashtable_policy.h
libstdc++-v3/include/std/bit
libstdc++-v3/testsuite/26_numerics/bit/bit.pow.two/ceil2.cc