Use frag_now_fix_octets in gas d10v, d30v
authorAlan Modra <amodra@gmail.com>
Tue, 4 Nov 2014 04:11:00 +0000 (14:41 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 4 Nov 2014 12:10:44 +0000 (22:40 +1030)
obstack_next_free is supposed to return a void* rather than the char*
it does currently, so expressions involving pointer arithmetic need
a cast.  Avoid the issue.

* config/tc-d10v.c (find_opcode): Call frag_now_fix_octets rather
than equivalent obstack_next_free expression.
* config/tc-d30v.c (find_format): Likewise.

gas/ChangeLog
gas/config/tc-d10v.c
gas/config/tc-d30v.c

index 18ceb94f1996410c9d77d782adce0513ed1890ad..bffcc37dfa236abc5b3ef3817100e6fb71572735 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-04  Alan Modra  <amodra@gmail.com>
+
+       * config/tc-d10v.c (find_opcode): Call frag_now_fix_octets rather
+       than equivalent obstack_next_free expression.
+       * config/tc-d30v.c (find_format): Likewise.
+
 2014-11-03  Nick Clifton  <nickc@redhat.com>
 
        * config/tc-msp430.c (msp430_srcoperand): Fix range test for
index 8e3d171cd5f4947fa2883ee4eac0c6a9f135cb87..dacfeb7467e8ffd799be9b04b457645a8f3a2f70 100644 (file)
@@ -1226,9 +1226,7 @@ find_opcode (struct d10v_opcode *opcode, expressionS myops[])
                  sym_frag = symbol_get_frag (myops[opnum].X_add_symbol);
                  found_symbol = FALSE;
 
-                 current_position =
-                   obstack_next_free (&frchain_now->frch_obstack)
-                   - frag_now->fr_literal;
+                 current_position = frag_now_fix_octets ();
                  symbol_position = S_GET_VALUE (myops[opnum].X_add_symbol);
 
                  for (f = frchain_now->frch_root; f; f = f->fr_next)
index 9076e4125c427387818853b97ddd6eb9fd83e723..a73f9b1f9e6a810d05c6c613d062a3a5cc2956ad 100644 (file)
@@ -1242,12 +1242,10 @@ find_format (struct d30v_opcode *opcode,
 
                      /* Calculate the current address by running through the
                         previous frags and adding our current offset.  */
-                     value = 0;
+                     value = frag_now_fix_octets ();
                      for (f = frchain_now->frch_root; f; f = f->fr_next)
                        value += f->fr_fix + f->fr_offset;
-                     value = (S_GET_VALUE (myops[j].X_add_symbol) - value
-                              - (obstack_next_free (&frchain_now->frch_obstack)
-                                 - frag_now->fr_literal));
+                     value = S_GET_VALUE (myops[j].X_add_symbol) - value;
                      if (check_range (value, bits, flags))
                        match = 0;
                    }