Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review/fix the coalesce and sort operations on PreorderAST nodes to account for the possibility of overflow #1124

Open
secure-sw-dev-bot opened this issue Jan 17, 2022 · 0 comments

Comments

@secure-sw-dev-bot
Copy link

This issue was copied from checkedc/checkedc-clang#1125


The coalesce and sort operations that are performed on the nodes of a PreorderAST implicitly re-associate the operands of + and * operators. If an expression like P + (E1 + E2) where the subexpression P has a checked pointer type and the subexpressions E1 and E2 have integral types, is re-associated as (P + E1) + E2, this is fine as this re-association does not introduce any new overflow scenarios that are not caught by runtime checks on checked pointer arithmetic. Whereas, if an expression like (P + E1) + E2 is re-associated as P + (E1 + E2), then there is a possibility that the subexpression (E1 + E2) may overflow and this overflow is not detected at runtime. Such a re-association should be performed by the compiler only if it can verify at compile-time that the subexpression (E1 + E2) will not overflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant