recog: Fix insn_change_watermark destructor
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 15 Jan 2021 16:45:41 +0000 (16:45 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Fri, 15 Jan 2021 16:45:41 +0000 (16:45 +0000)
commitf2cc526f47acbeeddd77b706a212b4703562e57f
treedaa358a815290aa5f13969d954e03e4ef6d7875d
parent7f6cdaa9a8da173ab9e93009f5b7ff427c7f964d
recog: Fix insn_change_watermark destructor

Noticed while working on something else that the insn_change_watermark
destructor could call cancel_changes for changes that no longer exist.
The loop in cancel_changes is a nop in that case, but:

  num_changes = num;

can mess things up.

I think this would only affect nested uses of insn_change_watermark.

gcc/
* recog.h (insn_change_watermark::~insn_change_watermark): Avoid
calling cancel_changes for changes that no longer exist.
gcc/recog.h