C++: Respond to review comments.

This commit is contained in:
Mathias Vorreiter Pedersen
2022-02-23 16:23:49 +00:00
parent 4b03778938
commit 033edc24f4
3 changed files with 6 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
| test.cpp:15:16:15:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:9:7:9:7 | x | x | test.cpp:10:3:10:13 | Store: ... = ... | here |
| test.cpp:58:16:58:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:51:36:51:36 | x | x | test.cpp:52:3:52:13 | Store: ... = ... | here |
| test.cpp:58:16:58:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:51:36:51:36 | y | y | test.cpp:52:3:52:13 | Store: ... = ... | here |
| test.cpp:73:16:73:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:62:7:62:7 | x | x | test.cpp:68:3:68:13 | Store: ... = ... | here |
| test.cpp:98:15:98:15 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:92:8:92:8 | s | s | test.cpp:93:3:93:15 | Store: ... = ... | here |
| test.cpp:111:16:111:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:102:7:102:7 | x | x | test.cpp:106:3:106:14 | Store: ... = ... | here |

View File

@@ -48,8 +48,8 @@ int store_argument_value() {
return *s101.p; // GOOD
}
void store_address_of_argument(int x) {
s101.p = &x;
void store_address_of_argument(int y) {
s101.p = &y;
}
int store_argument_address() {
@@ -59,8 +59,8 @@ int store_argument_address() {
}
void address_escapes_through_pointer_arith() {
int x = 0;
int* p0 = &x;
int x[2];
int* p0 = x;
int* p1 = p0 + 1;
int* p2 = p1 - 1;
int* p3 = 1 + p2;