Skip to content

detect invalid branches in the IR

Luc Van Oostenryck linux-sparse 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5add testcase for 'jump inside discarded expression statement'validation/linear/goto-and-expr-stmt0.c+28 -00 replies
2/5add testcases for linearization of invalid labelsvalidation/linear/invalid-labels0.c+19 -00 replies
3/5do not issue a branch to non-existent labellinearize.c validation/linear/invalid-labels0.c+11 -30 replies
4/5extract add_jump() from add_goto()linearize.c+11 -60 replies
5/5perform early CFG cleanupflow.c flow.h linearize.c +3 more+37 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [SPARSE PATCH 0/5] detect invalid branches in the IR

It's not allowed to do a goto into an expression statement. For exemple, it's not well defined what should happen if such an expression is not otherwise reachable and/or can be optimized away. For such situations GCC issues an error, clang doesn't and produce a valid IR but spare produce an invalid IR with branches to unexisting BBs.

The goal of the patches in this series is:
*) To detect such gotos and issue a sensible error. *) To make the IR somehow valid. Since the original
expression has been optimized away, the IR replace the goto by a branch to itself.

-- Luc

base-commit: 79f7ac984473d031dfb9cef00119c2d542d0d4a6

Signature · 1 line
2.26.0