expand_builtin_dwarf_reg_size

Hasdi R Hashim hasdi@bigfoot.com
Wed Sep 23 11:33:00 GMT 1998


Hello guys,

	[you may want to take a look at the function in dwarf2out.c to
understand what I am saying]

	I am in the process of building/modifying an md. One thing that
botched me is this function (while compiling _eh in libgcc2.c).
Specifically, this code: 

	  if ((DWARF_FRAME_REGNUM (ranges[n_ranges].end)
	       - DWARF_FRAME_REGNUM (ranges[n_ranges].beg))
	      != ranges[n_ranges].end - ranges[n_ranges].beg)
	    abort();

	[ DWARF_FRAME_REGNUM is aliased to DBX_REGISTER_NUMBER ]

	This function has an alternative block to speed up a common case
where n_ranges == 3. For n_ranges == 3, this is executed for ranges[1]. 
For machines for n_ranges!= 0, every single range will be tested. For most
machines, this isn't a problem. It will give a problem if a machine have
1) n_ranges != 3 and 2) DBX_REGISTER_NUMBER that orders the register
number in a particular way. config/i386/linux for example:

	 #define DBX_REGISTER_NUMBER(n) \
	 ((n) == 0 ? 0 \
	  : (n) == 1 ? 2 \
	  : (n) == 2 ? 1 \
	  : (n) == 3 ? 3 \
	  : (n) == 4 ? 6 \
	  : (n) == 5 ? 7 \
	  : (n) == 6 ? 5 \
	  : (n) == 7 ? 4 \
	  : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
	  : (-1))

	ranges[0].beg == 0; DBX_...(ranges[0].beg) == 0
	ranges[0].end == 7; DBX_...(ranges[0].end) == 4

These values will case cc1 to abort if i386 additional register range.

I see this is a bug because, the common case is not handled consistently
to the general case. I would submit a patch if I knew what this code is
trying to check. 

I noticed another inconsistency. This next code is executed only the
general case but not for the common case. Why is that?

	if (DWARF_FRAME_REGNUM (ranges[n_ranges].beg) >= size)
	   abort ();

Also, why is the final else-clause for DBX_REGISTER_NUMBER is (-1)? It
used to be (n+4) or (n+3) in 2.8 or so. What is the criteria of numbers to
return for DBX_REGISTER_NUMBER?

Thanks y'all

Hasdi

www.bigfoot.com/~hasdi





More information about the Gcc mailing list