You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
void f(int i) {
_Nt_array_ptr<char> p : bounds(p, p - i + 0) = "a";
if (*(p - i))
{}
}
We call the function NormalizeExprsWithoutConst which adds 0 constant to expressions not containing an integer constant. But the problem is we only add + 0 to an expression which contains addition and * 1 to an expression which contains multiplication. In the above case, we do not have addition or multiplication in the deref expression. This results in the bounds not getting widened.
The proper fix for this is to always add + 0 to every expression without checking the operator. This 0 constant would anyway be constant folded. So it should not be a problem.
The text was updated successfully, but these errors were encountered:
Previously, in order to normalize exprs we added zero only to exprs not
containing any other constants. Also, for binary nodes with + operator we added
+0 and for nodes with * operator we added *1. This resulted in exprs like "p -
i" which do not contain constants but also do not have + or * operator to not
get normalized. So we simply the logic to add zero. Now we simply add a binary
node with the + operator and a 0 child at the root of the AST. This makes the
logic simpler and handles a wider variety of cases.
This fixes issue #933
Previously, in order to normalize exprs we added zero only to exprs not
containing any other constants. Also, for binary nodes with + operator we added
+0 and for nodes with * operator we added *1. This resulted in exprs like "p -
i" which do not contain constants but also do not have + or * operator to not
get normalized. So we simply the logic to add zero. Now we simply add a binary
node with the + operator and a 0 child at the root of the AST. This makes the
logic simpler and handles a wider variety of cases.
This fixes issue #933
Handle the following case in bounds widening:
We call the function
NormalizeExprsWithoutConst
which adds 0 constant to expressions not containing an integer constant. But the problem is we only add+ 0
to an expression which contains addition and* 1
to an expression which contains multiplication. In the above case, we do not have addition or multiplication in the deref expression. This results in the bounds not getting widened.The proper fix for this is to always add
+ 0
to every expression without checking the operator. This 0 constant would anyway be constant folded. So it should not be a problem.The text was updated successfully, but these errors were encountered: