From f413dd7439e295849018caa01efa8d783e43f532 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Mon, 13 Jul 2020 16:01:00 +0100 Subject: [PATCH] Fix gdb.base/savedregs.exp with clang gdb.base/savedregs.exp fails to run with clang, because of: gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.base/savedregs.c:36:37: warning: operator '<<' has lower precedence than '+'; '+' will be evaluated first [-Wshift-op-parentheses] return callee (a1 << a2 * a3 / a4 + a6 & a6 % a7 - a8) + done; ~~ ~~~~~~~~~~~~~^~~~ /gdbtest/build/gdb/testsuite/gdb.base/savedregs.c:36:37: note: place parentheses around the '+' expression to silence this warning return callee (a1 << a2 * a3 / a4 + a6 & a6 % a7 - a8) + done; ^ ( ) 1 warning generated. This commit fixes it by adding the suggested parentheses. gdb/testsuite/ChangeLog: * gdb.base/savedregs.exp (caller): Use parentheses to make expected expression evaluation ordering explicit. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/savedregs.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8fa0a46c9e0..dec5a44307d 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-07-13 Gary Benson + + * gdb.base/savedregs.exp (caller): Use parentheses to + make expected expression evaluation ordering explicit. + 2020-07-13 Gary Benson * gdb.arch/i386-sse.c (have_sse) : Make unsigned. diff --git a/gdb/testsuite/gdb.base/savedregs.c b/gdb/testsuite/gdb.base/savedregs.c index 05fba506156..aec2a38f7f8 100644 --- a/gdb/testsuite/gdb.base/savedregs.c +++ b/gdb/testsuite/gdb.base/savedregs.c @@ -33,7 +33,7 @@ callee (int param) extern int caller (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) { - return callee (a1 << a2 * a3 / a4 + a6 & a6 % a7 - a8) + done; + return callee ((a1 << a2 * a3 / a4) + a6 & a6 % a7 - a8) + done; } static void -- 2.30.2