Re: [RFC PATCH] tools/memory-model: Remove (dep ; rfi) from ppo

From: Borislav Petkov
Date: Tue Feb 26 2019 - 06:38:25 EST


On Tue, Feb 26, 2019 at 12:30:08PM +0100, Peter Zijlstra wrote:
> When I used the argc variant, gcc-8 'works', but with s/argc/1/ it is
> still broken.

As requested on IRC:

$ gcc --version
gcc (SUSE Linux) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat ptr.c
#include <stdio.h>
#include <string.h>
int y = 2, x = 1;
int main (int argc, char **argv) {
int *p = &x + 1;
int *q = &y;
printf("p=%p q=%p\n", p, q);
if (!memcmp(&p, &q, sizeof(p))) {
*p = 11;
printf("x=%d y=%d *p=%d *q=%d\n", x, y, *p, *q);

$ gcc -O2 -fno-strict-aliasing -o ptr ptr.c ; ./ptr
p=0x601044 q=0x601044
x=1 y=2 *p=11 *q=2

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.