OSDN Git Service

[ADT] APFloatBase: Prevent collapsing semPPCDoubleDouble and semBogus
authorMichal Gorny <mgorny@gentoo.org>
Tue, 3 Jan 2017 16:33:50 +0000 (16:33 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Tue, 3 Jan 2017 16:33:50 +0000 (16:33 +0000)
commit1b07ec5449b2bc46d776446a04e8502732d79057
treeade8d20d656cc7a044a38ff14f688e6a5238bd9b
parenta3bfbbd5a2c5b7d9b2f4203369d05f4bda7df1a6
[ADT] APFloatBase: Prevent collapsing semPPCDoubleDouble and semBogus

Provide a distinct contents for semBogus and semPPCDoubleDouble in order
to prevent compilers from collapsing them to a single memory address,
while we heavily rely on every semantic having distinct address.

This happens if insecure optimization collapsing identical values is
enabled. As a result, APFloats of semBogus are indistinguishable from
semPPCDoubleDouble -- and whenever the move constructor is used, the old
value beings being incorrectly recognized as a semPPCDoubleDouble.

Since the values in semPPCDoubleDouble are not used anywhere,
we can easily solve this issue via altering the value of one of the
fields and therefore ensuring that the collapse can not occur.

Differential Revision: https://reviews.llvm.org/D28112

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290896 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/APFloat.cpp