]> git.ipfire.org Git - thirdparty/gcc.git/commit
Limit special asan/ubsan/bitint returns_twice handling to calls in bbs with abnormal...
authorJakub Jelinek <jakub@redhat.com>
Fri, 12 Apr 2024 08:59:54 +0000 (10:59 +0200)
committerJakub Jelinek <jakub@redhat.com>
Fri, 12 Apr 2024 08:59:54 +0000 (10:59 +0200)
commitc9e94ae448ba309dba74de3ee1974a3ed9248889
treeb3534757d49a0c0d45ea987c2819869e2c67594d
parente30e760b51b108786946e04a26e92531762b022d
Limit special asan/ubsan/bitint returns_twice handling to calls in bbs with abnormal pred [PR114687]

The tree-cfg.cc verifier only diagnoses returns_twice calls preceded
by non-label/debug stmts if it is in a bb with abnormal predecessor.
The following testcase shows that if a user lies in the attributes
(a function which never returns can't be pure, and can't return
twice when it doesn't ever return at all), when we figure it out,
we can remove the abnormal edges to the "returns_twice" call and perhaps
whole .ABNORMAL_DISPATCHER etc.
edge_before_returns_twice_call then ICEs because it can't find such
an edge.

The following patch limits the special handling to calls in bbs where
the verifier requires that.

2024-04-12  Jakub Jelinek  <jakub@redhat.com>

PR sanitizer/114687
* gimple-iterator.cc (gsi_safe_insert_before): Only use
edge_before_returns_twice_call if bb_has_abnormal_pred.
(gsi_safe_insert_seq_before): Likewise.
* gimple-lower-bitint.cc (bitint_large_huge::lower_call): Only
push to m_returns_twice_calls if bb_has_abnormal_pred.

* gcc.dg/asan/pr114687.c: New test.
gcc/gimple-iterator.cc
gcc/gimple-lower-bitint.cc
gcc/testsuite/gcc.dg/asan/pr114687.c [new file with mode: 0644]