genrecog: Fix crash on invalid input

If your machine description refers to a non-existent predicate genrecog
crashes.  This fixes it.


	* genrecog.c (match_pattern_2): If pred is NULL don't call
	safe_predicate_mode on it.

From-SVN: r234206
This commit is contained in:
Segher Boessenkool 2016-03-15 01:42:43 +01:00 committed by Segher Boessenkool
parent 26a7773c2f
commit 26a8813fa3
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2016-03-15 Segher Boessenkool <segher@kernel.crashing.org>
* genrecog.c (match_pattern_2): If pred is NULL don't call
safe_predicate_mode on it.
2016-03-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/70219

View File

@ -4037,7 +4037,7 @@ match_pattern_2 (state *s, md_rtx_info *info, position *pos, rtx pattern)
/* Check the mode first, to distinguish things like SImode
and DImode register_operands, as described above. */
machine_mode mode = GET_MODE (e->pattern);
if (safe_predicate_mode (pred, mode))
if (pred && safe_predicate_mode (pred, mode))
s = add_decision (s, rtx_test::mode (e->pos), mode, true);
/* Assign to operands[] first, so that the rtx usually doesn't