steakhal added a comment. In D136162#3865081 <https://reviews.llvm.org/D136162#3865081>, @martong wrote:
> Hmm, seems like the conflicting prototype (i.e. the obsolescent use of zero > parameters) is needed to reproduce the assertion failure. That makes me > wonder, how does the redecl chain of `b` looks like? Is `void b()` chained > with `void b(int*)`, or are they represented independently from each other? I > guess they form the same redecl chain. Which drives us to the next questions. > When the analyzer reaches the CallExpr `b(&buffer)` which FunctionDecl does > it see? Is it `b()` or `b(int*)`? My bet, it sees and works with `b()`. Yes, they form the same redecl chain, indeed. The call `b(&buffer)` refers to the `void ()` decl - with no parameters. The range of `->redecls()` of that decl has two items: The decl of `void ()`, and the decl of `void (int *)`. > Could we detect if the arguments of the CallExpr does not match the > parameters of the FunctionDecl? And if that is the case, could we iterate > through the redecl chain to find an appropriate matching FunctionDecl? That > would be `b(int*)` in this case ... and the original `bindArray()` should > work then. Good idea. Actually, the CFG already refers to the `void ()` delc, so we should probably change it there instead of doing the same in the CSA. Let me investigate this route. In D136162#3865094 <https://reviews.llvm.org/D136162#3865094>, @martong wrote: >> A similar situation could happen if we reinterpret cast pointers, etc. so >> the situation is not limited to conflicting function prototypes. > > Please provide tests for those cases. It was a harsh guess on my part, simply by looking at the missing `ElementRegion`, I thought that I could reconstruct the example by some reinterpret-cast tricks - but I could not pull it off. Disregard that part. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D136162/new/ https://reviews.llvm.org/D136162 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits