https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66066
kugan at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kugan at gcc dot gnu.org --- Comment #5 from kugan at gcc dot gnu.org --- I ran into this today when I created a cross compiler for aarch64-linux-gnu. It also happens with arm. As Richard Biener suggested, -pedantic helps. How about this: diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 3fcb7c2..d5d82fd 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -10702,7 +10702,7 @@ build_binary_op (location_t location, enum tree_code code, { /* Don't reject a left shift of a negative value in a context where a constant expression is needed in C90. */ - if (flag_isoc99) + if (flag_isoc99 && pedantic) int_const = false; if (c_inhibit_evaluation_warnings == 0) warning_at (location, OPT_Wshift_negative_value,