This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch to fix internal error



Given malformed MIPS code like:

	ori $8,$8,$9

gas will report:

foo.S:556: Internal error, aborting at gas/symbols.c line 1817 in
S_SET_SEGMENT.
Please report this bug.

(where 556 is the last line of the file, not the faulty line).  It would
be nice to have the "register value used as constant" message that you get
in some other circumstances.

The same thing can be deliberately triggered in other types of operand:

	lui $8,$9
	j 1+$9

Would it be OK to add the error handling code to fix_new_exp(), as in the
patch below?  Or should tc-mips.c really do the check itself?

Richard

2001-03-22  Richard Sandiford  <rsandifo@redhat.com>

	* write.c (fix_new_exp): Print an error if passed a register.

Index: write.c
===================================================================
RCS file: /cvs/src/src/gas/write.c,v
retrieving revision 1.28
diff -c -p -d -r1.28 write.c
*** write.c	2001/03/20 03:12:01	1.28
--- write.c	2001/03/22 15:56:08
*************** fix_new_exp (frag, where, size, exp, pcr
*** 283,288 ****
--- 283,292 ----
      case O_absent:
        break;

+     case O_register:
+       as_bad (_("register value used as expression"));
+       break;
+
      case O_add:
        /* This comes up when _GLOBAL_OFFSET_TABLE_+(.-L0) is read, if
  	 the difference expression cannot immediately be reduced.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]