]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
bb-reorder: Fix assertion
authorJakub Jelinek <jakub@redhat.com>
Fri, 8 Mar 2024 11:49:43 +0000 (12:49 +0100)
committerJakub Jelinek <jakub@redhat.com>
Fri, 8 Mar 2024 11:49:43 +0000 (12:49 +0100)
When touching bb-reorder yesterday, I've noticed the checking assert
doesn't actually check what it meant to.
Because asm_noperands returns >= 0 for inline asm patterns (in that case
number of input+output+label operands, so asm goto has at least one)
and -1 if it isn't inline asm.

The following patch fixes the assertion to actually check that it is
asm goto.

2024-03-08  Jakub Jelinek  <jakub@redhat.com>

* bb-reorder.cc (fix_up_fall_thru_edges): Fix up checking assert,
asm_noperands < 0 means it is not asm goto too.

gcc/bb-reorder.cc

index 7998c0a148e42cf215f1e881452b5755970e6725..ba11a2337ab75d924d957ddff0ac158ee7e5cfaa 100644 (file)
@@ -2024,7 +2024,8 @@ fix_up_fall_thru_edges (void)
                             See PR108596.  */
                          rtx_insn *j = BB_END (cur_bb);
                          gcc_checking_assert (JUMP_P (j)
-                                              && asm_noperands (PATTERN (j)));
+                                              && (asm_noperands (PATTERN (j))
+                                                  > 0));
                          edge e2 = find_edge (cur_bb, e->dest);
                          if (e2)
                            e2->flags |= EDGE_CROSSING;