[PATCH]: Fix bogus overflow warnings from SH .byte directives

Nick Clifton nickc@redhat.com
Wed Jul 12 09:00:00 GMT 2006


Hi Guys,

  The attached file "too_large.s" is a distilled version of a gcc
  compiled test case that triggers a problem with the SH port of GAS.
  When assembled it generates these error messages for some .byte
  directives:

  too_large.s:6: Error: value of 310 too large for field of 1 bytes at 256
  too_large.s:7: Error: value of 298 too large for field of 1 bytes at 257
  too_large.s:8: Error: value of 260 too large for field of 1 bytes at 258
  too_large.s:9: Error: value of 286 too large for field of 1 bytes at 259

  The values are in fact OK.  The problem is that the SH backend has
  computed the correct value and checked its range, but it has not
  told the generic code about this.

  There are two possible ways to solve this problem.  Either the SH
  backend can return the correct value to the generic code, which will
  then range check it again.  Or it can just tell the generic code
  that the (wrong) value that it has has already been range checked
  and that it does not need to be checked again.  I have gone for the
  latter method.

Cheers
  Nick

gas/ChangeLog
2006-07-12  Nick Clifton  <nickc@redhat.com>

	* config/tc-sh.c (md_apply_fix): Do not allow the generic code in
	fixup_segment() to repeat a range check on a value that have
	already been checked here.

gas/testsuite/ChangeLog
2006-07-12  Nick Clifton  <nickc@redhat.com>

	* gas/sh/basic.exp: Run "too_large" dump test.
	* gas/sh/too_large.s: New test file.  Check that .byte directives
	do not generate a bogus overflow message.
	* gas/sh/too_large.s: New test control file.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tc-sh.c.patch
Type: text/x-patch
Size: 846 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060712/e1aced65/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: basic.exp.patch
Type: text/x-patch
Size: 1636 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060712/e1aced65/attachment-0001.bin>


More information about the Binutils mailing list