From 6d6ad65b43efa17a825702297331fcb290445a18 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 1 Dec 2016 10:38:40 +0000 Subject: [PATCH] Fix ICE in assembler when passed a corrupt input file. PR gas/20895 * symbols.c (resolve_symbol_value): Gracefully handle erroneous symbolic expressions. --- gas/ChangeLog | 6 ++++++ gas/symbols.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index e8912cd2217..385ff56c0ed 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2016-12-01 Nick Clifton + + PR gas/20895 + * symbols.c (resolve_symbol_value): Gracefully handle erroneous + symbolic expressions. + 2016-11-29 Claudiu Zissulescu * config/tc-arc.c (find_opcode_match): New function argument diff --git a/gas/symbols.c b/gas/symbols.c index 9115d7ec6d6..66865e0ef42 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1429,7 +1429,16 @@ resolve_symbol_value (symbolS *symp) case O_gt: left = left > right ? ~ (offsetT) 0 : 0; break; case O_logical_and: left = left && right; break; case O_logical_or: left = left || right; break; - default: abort (); + + case O_illegal: + case O_absent: + case O_constant: + /* See PR 20895 for a reproducer. */ + as_bad (_("Invalid operation on symbol")); + goto exit_dont_set_value; + + default: + abort (); } final_val += symp->sy_frag->fr_address + left; -- 2.30.2