Xazax-hun wrote:

> So this indeed looks like a special case of a throw expression and not 
> specific to control flow. WDYT @Xazax-hun

Let me elaborate a bit on my thinking. Indeed the crash itself is not specific 
to the control flow. 
But we actually have two independent problems:

1. The crash due to the type mismatch
2. False control flow due to how we generate facts.

I think 1. is well understood, the problem 2 is for generating flow fact for 
the false branch in code like:

```
  int *p = true ? q : r;
```

We should not have flow from `r` to `p` but we do. Why? Because `r` is a 
subexpression of the ternary and the fact generation will only look at the 
subexpressions of the ternary without consulting the CFG whether we actually 
have an edge between those AST nodes in the control flow.

So my line of thinking was that since both problem 1 and 2 are could be solved 
by checking for the flow between the CFG nodes that correspond to the AST nodes 
we can solve both of these issues with the same fix. 

I think we might want to fix problem 2. eventually anyway, and if fixing 
problem 2 also fixes problem 1, there might be no point in introducing a 
special case for problem 1. But let me know if you disagree.

https://github.com/llvm/llvm-project/pull/190345
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to