bug in gas/read.c:s_space ?

Geoff Berry geoffb@bops.com
Mon Apr 3 15:35:00 GMT 2000


It seems to me that the error checking in the included snippet of
s_space() is incorrect since the error is only reported if exp (which
is the size expression) is non-constant.  This leads to weird behaivor
if someone mistakenly writes

	.space	0x100, a

I would send a patch, but I don't really understand the intention of
the code in the else branch.

>From gas/read.c:2870

  if (val.X_op != O_constant
      || val.X_add_number < - 0x80
      || val.X_add_number > 0xff
      || (mult != 0 && mult != 1 && val.X_add_number != 0))
    {
      if (exp.X_op != O_constant)
	as_bad ("Unsupported variable size or fill value");
      else
	{
	  offsetT i;

	  if (mult == 0)
	    mult = 1;
	  bytes = mult * exp.X_add_number;
	  for (i = 0; i < exp.X_add_number; i++)
	    emit_expr (&val, mult);
	}
    }
  else
    {
	...
-- 
Geoff Berry


More information about the Binutils mailing list