This is the mail archive of the binutils@sourceware.cygnus.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]

bug in gas/read.c:s_space ?


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

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