clang: & precedence

Niels Möller nisse at
Sat Nov 30 12:04:07 UTC 2013

Thomas Klausner <wiz at> writes:

> --- toom44_mul.o ---
> /archive/foreign/src/external/lgpl3/gmp/lib/libgmp/../../dist/mpn/generic/toom44_mul.c:209:52: error: '&' within '|' [-Werror,-Wbitwise-op-parentheses]
>   flags = (enum toom7_flags) (flags | toom7_w3_neg & mpn_toom_eval_dgr3_pm1 (apx, amx, ap, n, s, tp));
>                                     ~ ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'd first like to say that it's asking for trouble to use the -Werror
flag to the compiler. Don't do that, unless you like trouble. Lots of
perfectly valid C code will fail to compile (a bit depending on what
warning you enabled, but it seem syou use something like -Wall -Werror).

> Before I start working on this, I'd like to know if I start adding
> parentheses and send them to you, will they be accepted?

To me, adding parenthesis seems ok. I have difficulty remembering
precedence for all operators, and I tend to use extra parentheses
everywhere gcc -Wall suggests it.


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-bugs mailing list