hnrklssn wrote:

> Thanks for the fix!
> 
> I was wondering if the new code paths should actually return `true` not 
> `false`, but I think it makes sense that for a comparison like `"hello" + 6 
> == "world"`, we say that the strings are _not_ potentially-overlapping but we 
> instead detect the case of comparing a past-the-end pointer to one complete 
> object against the start of another complete object.

That's an interesting thought. I tried it out real quick to see what the 
difference would be. Instead of `comparison against pointer '&"foo"[4]' that 
points past the end of a complete object has unspecified value`, we get 
`comparison of addresses of potentially overlapping literals has unspecified 
value`. I haven't investigated the code paths to see whether it's guaranteed 
that we always get that diagnostic, but I do think it's more useful with the 
diagnostic being specific about past-the-end being the issue.

https://github.com/llvm/llvm-project/pull/137078
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to