[cfe-dev] Pointer arithmetic

Chris Lattner clattner at apple.com
Sun Dec 9 14:10:47 PST 2007

On Dec 9, 2007, at 4:38 AM, Sanghyeon Seo wrote:

> The following error is not diagnosed.
> int test(int *a, double *b) { return a - b; }

Yep, as it turns out, we were completely missing the requires sema  
checks for pointer subtraction.  I implemented these here:

> By the way, this does crash in CodeGen. Can CodeGen assume that the
> code is correctly typed, or is it still a good idea to sprinkle
> asserts in CodeGen?

CodeGen can assume that Sema reported no errors, but it has to  
tolerate code that only produces warnings.


More information about the cfe-dev mailing list