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
classObj {};
voidtop() {
Obj buf[10];
Obj copy(buf[404]); // No issue with ArrayBound, but ArrayBoundV2 reports this
(void)copy;
}
I was wondering if there is something wrong with check::Location given that we now report this with the PostStmt<ArraySubscriptExpr> callback.
It turns out that the copy-constructor takes the parameter by reference - no surprise. Consequently, there is no lvalue to rvalue conversion (aka. we don't have a read operation). However, one could argue that a copy-constructor should really do a load of the argument passed, thus begs the question:
Shouldn't we force model a "load" for copy-constructor, move-constructor, copy-assignment, move-assignment?
Any opinions?
The text was updated successfully, but these errors were encountered:
steakhal
changed the title
[analyzer] Copy-constructor should trigger a load
[analyzer] Copy-constructor should trigger a load for check::Location
Mar 23, 2024
classObj {};
voidtop() {
Obj buf[10];
Obj copy(buf[404]); // No issue with ArrayBound, but ArrayBoundV2 reports this
(void)copy;
}
I was wondering if there is something wrong with check::Location given that we now report this with the PostStmt<ArraySubscriptExpr> callback.
It turns out that the copy-constructor takes the parameter by reference - no surprise. Consequently, there is no lvalue to rvalue conversion (aka. we don't have a read operation). However, one could argue that a copy-constructor should really do a load of the argument passed, thus begs the question:
Shouldn't we force model a "load" for copy-constructor, move-constructor, copy-assignment, move-assignment?
Recently I was investigating a new diagnostic caused by #72107 ([analyzer] Switch to PostStmt callbacks in ArrayBoundV2).
Eventually drilled down to this:
I was wondering if there is something wrong with
check::Location
given that we now report this with thePostStmt<ArraySubscriptExpr>
callback.It turns out that the copy-constructor takes the parameter by reference - no surprise. Consequently, there is no lvalue to rvalue conversion (aka. we don't have a read operation). However, one could argue that a copy-constructor should really do a load of the argument passed, thus begs the question:
Shouldn't we force model a "load" for copy-constructor, move-constructor, copy-assignment, move-assignment?
Any opinions?
The text was updated successfully, but these errors were encountered: