Caused segfault for pattern containing no captures at: info.safe_grow_cleared(capture_max + 1); in capture_info::capture_info
artificial test-case: (define_predicates integer_zerop) (simplify (bit_not integer_zerop) { build_zero_cst (type); }) * genmatch.c (simplify::simplify): Set simplify::capture_max to 0 if pattern contains no captures. Thanks, Prathamesh
Index: gcc/genmatch.c =================================================================== --- gcc/genmatch.c (revision 218664) +++ gcc/genmatch.c (working copy) @@ -576,7 +576,7 @@ : match (match_), match_location (match_location_), result (result_), result_location (result_location_), ifexpr_vec (ifexpr_vec_), for_vec (for_vec_), - capture_ids (capture_ids_), capture_max (capture_ids_->elements () - 1) {} + capture_ids (capture_ids_), capture_max (capture_ids_->elements () ? capture_ids_->elements () - 1 : 0) {} /* The expression that is matched against the GENERIC or GIMPLE IL. */ operand *match;