diff options
| -rw-r--r-- | targets/agent_list.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/targets/agent_list.c b/targets/agent_list.c index 8787638..65c9274 100644 --- a/targets/agent_list.c +++ b/targets/agent_list.c @@ -31,7 +31,10 @@ int main(int argc, char **argv) { void *page = aligned_alloc(4096, 4096); memset(page, 1, 4096); - long sum = ((char *)page)[100] - 1; + // Read through a volatile pointer: at -O1 the compiler otherwise knows + // the answer and deletes the allocation it came from. + volatile char *probe = page; + long sum = probe[100] - 1; while (head) { struct node *node = head; head = node->next; |
