fix: __builtin_bswap{16,32,64}() constantness
commit9e34da46b99e1e43ed40ec019cce8c06c22eb3fa
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Tue, 20 Jun 2017 15:50:04 +0000 (20 17:50 +0200)
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Wed, 21 Jun 2017 09:28:40 +0000 (21 11:28 +0200)
treedd9302c738bcec49bb7244c7e860f4b820599d6b
parent657ea654866b18a368b220bba272b17369b78fe4
fix: __builtin_bswap{16,32,64}() constantness

When expanding those builtins, we directly excludes a non-constant
arg (via the expression expansion cost) and the to retrieve the
value we use const_expression_value().

But const_expression_value() is to be used for expressions that
qualify as 'integer constant expression' as per the C standard.
However we want to be able to use this builtin with all integer
expressions having a known value at compile time, even those
not qualified as true 'integer constant expression'.

Fix this by using get_expression_value_silent() instead of
const_expression_value().

Note: this bug was found by testing sparse on the git tree
      on ARM64.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Acked-by: Christopher Li <sparse@chrisli.org>
builtin.c
validation/builtin-bswap-constant.c