diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-11-28 15:13:52 +0900 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-11-28 15:13:52 +0900 |
| commit | 319ac31529eb7bf7e5a4ef582c6f930bd8fca62e (patch) | |
| tree | 9482c3c67f7ad579329c25bedeea64975e63df94 | |
| parent | 84bf0b37741fadd88c8ce8591e77476880dd209a (diff) | |
Assert that non-empty LINK_ANCHOR does not loop
After any `LINK_ELEMENT` sequence is added, `LINK_ANCHOR` must not
loop.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12195
| -rw-r--r-- | compile.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -1290,10 +1290,15 @@ static void APPEND_LIST(ISEQ_ARG_DECLARE LINK_ANCHOR *const anc1, LINK_ANCHOR *const anc2) { if (anc2->anchor.next) { + /* LINK_ANCHOR must not loop */ + RUBY_ASSERT(anc2->last != &anc2->anchor); anc1->last->next = anc2->anchor.next; anc2->anchor.next->prev = anc1->last; anc1->last = anc2->last; } + else { + RUBY_ASSERT(anc2->last == &anc2->anchor); + } verify_list("append", anc1); } #if CPDEBUG < 0 |
