Fix ICE in assembler when passed a corrupt input file.
authorNick Clifton <nickc@redhat.com>
Thu, 1 Dec 2016 10:38:40 +0000 (10:38 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 1 Dec 2016 10:38:40 +0000 (10:38 +0000)
PR gas/20895
* symbols.c (resolve_symbol_value): Gracefully handle erroneous
symbolic expressions.

gas/ChangeLog
gas/symbols.c

index e8912cd2217f6001d0c47b71ec3547302f6f529e..385ff56c0ed9021e4eb0e04ec20d9ed2bed6fe74 100644 (file)
@@ -1,3 +1,9 @@
+2016-12-01  Nick Clifton  <nickc@redhat.com>
+
+       PR gas/20895
+       * symbols.c (resolve_symbol_value): Gracefully handle erroneous
+       symbolic expressions.
+
 2016-11-29  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * config/tc-arc.c (find_opcode_match): New function argument
index 9115d7ec6d65ae1eceea14d607fffc01ec458a2a..66865e0ef42b66572be0490de03bb0ae2998c4dc 100644 (file)
@@ -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;