aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-bpf.c
diff options
context:
space:
mode:
authorWill Hawkins <hawkinsw@obs.cr>2024-02-19 19:24:19 +0100
committerJose E. Marchesi <jose.marchesi@oracle.com>2024-02-19 20:48:17 +0100
commitecd16ae4e47118f66447641d93a6aa1334e550d4 (patch)
treef380299e54fdd5305a88aae44fa0efd35b3c62ba /gas/config/tc-bpf.c
parentb86b514aace19799ea141514e16296fb63a089b3 (diff)
downloadbinutils-ecd16ae4e47118f66447641d93a6aa1334e550d4.zip
binutils-ecd16ae4e47118f66447641d93a6aa1334e550d4.tar.gz
binutils-ecd16ae4e47118f66447641d93a6aa1334e550d4.tar.bz2
bpf: fix bpf expression parsing regression in GAS
As a result of a switch instead of an if, as would issue non-specific error messages when it encountered an operand it could not parse in bpf. This patch fixes that regression and adds a test to prevent it from reoccurring. Tested for bpf-unknown-none on x86_64-redhat-linux. gas/ChangeLog: * config/tc-bpf.c (parse_expression): Change switch to if so that error * condition is handled. * testsuite/gas/bpf/bpf.exp: Invoke new test. * testsuite/gas/bpf/indcall-badoperand.d: New test. * testsuite/gas/bpf/indcall-badoperand.l: New test. * testsuite/gas/bpf/indcall-badoperand.s: New test.
Diffstat (limited to 'gas/config/tc-bpf.c')
-rw-r--r--gas/config/tc-bpf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
index e23de4e..dfa44ea 100644
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -1240,7 +1240,7 @@ parse_expression (char *s, expressionS *exp)
s = input_line_pointer;
input_line_pointer = saved_input_line_pointer;
- switch (exp->X_op == O_absent || exp_parse_failed)
+ if (exp->X_op == O_absent || exp_parse_failed)
return NULL;
/* The expression parser may consume trailing whitespaces. We have