This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

simplify_subreg aborts bad?



In simplify-rtx.c in simplify_subreg, there are three aborts listed
under "sanity checking".  IMHO at least two of these should be return
0 and not abort, or all the places which call simplify_subreg need to
pre-validate the rtx they pass.

The comment above simplify_subreg states: "Return 0 if no
simplifications is possible."  Doesn't that apply for bogus subregs,
where certainly no simplification is possible?

>  if (innermode == VOIDmode || outermode == VOIDmode
>       || innermode == BLKmode || outermode == BLKmode)
>     abort ();

combine_simplify_rtx tries to simplify all subregs *before* checking
to see if the pattern is valid, and it's pretty much throwing patterns
together at random.  Since it isn't validating the patterns,
simplify_subreg should be conservative about handling bogus patterns.
In my case, combine tried to combine a subreg with a VOIDmode setcc
precursor pattern (please don't say "you shouldn't do VOIDmode
setcc's" because that's not my point).

>   if (byte % GET_MODE_SIZE (outermode)
>       || byte >= GET_MODE_SIZE (innermode))
>     abort ();

Consider a machine with 16-bit registers, and this struct:

	struct foo {
	  short a;
	  long b;
	  short c;
	};

If the struct is held in four registers, what's wrong with trying to
extract the middle two registers?  And what about machines that can do
unaligned memory accesses, like the IA-32?  Extracting an unaligned
word isn't a problem for those.


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