[control][hotfix] Don't fail when not all exit nodes are prune nodes

Summary:
Clang front-end is confused about exceptional CF. For the following program
```
void throw_positive(int b) {
  if (b > 0) {
    throw std::length_error("error");
  }
}

void foo(  std::vector<std::string> traceTokens){
if (traceTokens.size() < 13) {
    throw std::invalid_argument("Exception!"); // 1
  }

for (int i = 13; i < traceTokens.size(); ++i) {
          try {
            throw_positive(traceTokens[i].size());
          } catch (std::range_error& msg) {
            throw(1); // 2
          }
           try {
            throw_positive(traceTokens[7].size());
          } catch (std::range_error& msg) {
             throw (9); // 3
          }
 }
}
```
Here, infer thinks that there are edges from 1->2 and 1-> 3. This should not be the case.

This in turn makes control analysis think that there is a back edge from 3->2 and violates the assertion that the exit node (3 in this case) must be a prune node...

Replacing assertion with internal error for now until I fix the clang frontend.

Reviewed By: skcho

Differential Revision: D25947376

fbshipit-source-id: 5c6529647
master
Ezgi Çiçek 4 years ago committed by Facebook GitHub Bot
parent 7b8145b8bc
commit d1935941a6

@ -164,7 +164,8 @@ module TransferFunctionsControlDeps (CFG : ProcCfg.S) = struct
astate' )
| _ ->
(* Exit node must be a prune node *)
assert (not (ExitNodeToLoopHeads.mem node exit_map)) ;
if ExitNodeToLoopHeads.mem node exit_map then
L.internal_error "Exit node must be a prune node!" ;
astate'

Loading…
Cancel
Save