public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Paul E. McKenney" <paulmck@linux.ibm.com>
Cc: Andrea Parri <andrea.parri@amarulasolutions.com>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	Alan Stern <stern@rowland.harvard.edu>,
	Will Deacon <will.deacon@arm.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	David Howells <dhowells@redhat.com>,
	Jade Alglave <j.alglave@ucl.ac.uk>,
	Luc Maranget <luc.maranget@inria.fr>,
	Akira Yokosawa <akiyks@gmail.com>,
	Daniel Lustig <dlustig@nvidia.com>
Subject: Re: [RFC PATCH] tools/memory-model: Remove (dep ; rfi) from ppo
Date: Tue, 26 Feb 2019 12:30:08 +0100	[thread overview]
Message-ID: <20190226113008.GI32534@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190226112521.GH32534@hirez.programming.kicks-ass.net>

On Tue, Feb 26, 2019 at 12:25:21PM +0100, Peter Zijlstra wrote:
> On Tue, Feb 26, 2019 at 12:21:33PM +0100, Peter Zijlstra wrote:
> 
> > Also; we need to find a GCC person to find/give us a knob to kill this
> > entire class of nonsense. This is just horrible broken shit:
> > 
> > 
> > ~/tmp# gcc -O2 -fno-strict-aliasing  -o ptr ptr.c ; ./ptr
> > p=0x5635dd3d5034 q=0x5635dd3d5034
> > x=1 y=2 *p=11 *q=2
> > ~/tmp# cat ptr.c
> > #include <stdio.h>
> > #include <string.h>
> > int y = 2, x = 1;
> > int main (int argc, char **argv) {
> > 	int *p = &x + argc;
> 
> damn; wrong version; that should've been: s/argc/1/
> same result though.

Note that gcc (as used above) was:

  gcc (Debian 7.3.0-3) 7.3.0

When I used the argc variant, gcc-8 'works', but with s/argc/1/ it is
still broken.

  gcc-8 (Debian 8.2.0-21) 8.2.0
  gcc (Debian 7.3.0-3) 7.3.0
  gcc-6 (Debian 6.4.0-12) 6.4.0 20180123
  gcc-5 (Debian 5.5.0-8) 5.5.0 20171010
  gcc-4.6 (Debian 4.6.3-14) 4.6.3

all generate the exact same broken crap with the '+ 1' variant.

> > 	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);
> > 	}
> > }

  parent reply	other threads:[~2019-02-26 11:30 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 22:57 [RFC PATCH] tools/memory-model: Remove (dep ; rfi) from ppo Andrea Parri
2019-02-19 22:57 ` Andrea Parri
2019-02-20  2:01 ` Paul E. McKenney
2019-02-20  2:01   ` Paul E. McKenney
2019-02-20  9:26   ` Peter Zijlstra
2019-02-20  9:26     ` Peter Zijlstra
2019-02-20  9:57     ` Will Deacon
2019-02-20  9:57       ` Will Deacon
2019-02-20 13:17       ` Andrea Parri
2019-02-20 13:17         ` Andrea Parri
2019-02-20 13:14     ` Andrea Parri
2019-02-20 13:14       ` Andrea Parri
2019-02-20 13:27       ` Peter Zijlstra
2019-02-20 13:27         ` Peter Zijlstra
2019-02-22 11:21         ` Andrea Parri
2019-02-22 11:21           ` Andrea Parri
2019-02-22 13:00           ` Peter Zijlstra
2019-02-22 13:00             ` Peter Zijlstra
2019-02-25 17:55             ` Paul E. McKenney
2019-02-25 17:55               ` Paul E. McKenney
2019-02-26  9:21               ` Peter Zijlstra
2019-02-26  9:21                 ` Peter Zijlstra
2019-02-26  9:30               ` Peter Zijlstra
2019-02-26  9:30                 ` Peter Zijlstra
2019-02-26 10:45                 ` Peter Zijlstra
2019-02-26 10:45                   ` Peter Zijlstra
2019-02-26 11:21                   ` Peter Zijlstra
2019-02-26 11:21                     ` Peter Zijlstra
2019-02-26 11:25                     ` Peter Zijlstra
2019-02-26 11:25                       ` Peter Zijlstra
2019-02-26 11:30                       ` Peter Zijlstra [this message]
2019-02-26 11:30                         ` Peter Zijlstra
2019-02-26 11:38                         ` Borislav Petkov
2019-02-26 11:38                           ` Borislav Petkov
2019-02-26 13:49                           ` Peter Zijlstra
2019-02-26 13:49                             ` Peter Zijlstra
2019-02-26 14:28                             ` Paul E. McKenney
2019-02-26 14:28                               ` Paul E. McKenney
2019-02-26 14:47                               ` Peter Zijlstra
2019-02-26 14:47                                 ` Peter Zijlstra
2019-02-26 15:39                                 ` Paul E. McKenney
2019-02-26 15:39                                   ` Paul E. McKenney
2019-02-26 14:56                               ` Akira Yokosawa
2019-02-26 14:56                                 ` Akira Yokosawa
2019-02-26 15:04                                 ` Paul E. McKenney
2019-02-26 15:04                                   ` Paul E. McKenney
2019-02-26 15:09                                   ` Akira Yokosawa
2019-02-26 15:09                                     ` Akira Yokosawa
2019-02-26 15:04                               ` Peter Zijlstra
2019-02-26 15:04                                 ` Peter Zijlstra
2019-03-06 15:46                                 ` Akira Yokosawa
2019-03-06 15:46                                   ` Akira Yokosawa
2019-03-06 16:58                                   ` Peter Zijlstra
2019-03-06 16:58                                     ` Peter Zijlstra
2019-03-06 17:26                                     ` Paul E. McKenney
2019-03-06 17:26                                       ` Paul E. McKenney
2019-03-06 17:24                                   ` Paul E. McKenney
2019-03-06 17:24                                     ` Paul E. McKenney
2019-03-02 15:27                             ` Akira Yokosawa
2019-03-02 15:27                               ` Akira Yokosawa
2019-03-04 16:09                               ` Paul E. McKenney
2019-03-04 16:09                                 ` Paul E. McKenney
2019-02-20 13:41       ` Will Deacon
2019-02-20 13:41         ` Will Deacon
2019-02-20 15:30         ` Alan Stern
2019-02-20 15:30           ` Alan Stern
2019-02-20 15:22 ` Alan Stern
2019-02-20 15:22   ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190226113008.GI32534@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akiyks@gmail.com \
    --cc=andrea.parri@amarulasolutions.com \
    --cc=boqun.feng@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dlustig@nvidia.com \
    --cc=j.alglave@ucl.ac.uk \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.maranget@inria.fr \
    --cc=npiggin@gmail.com \
    --cc=paulmck@linux.ibm.com \
    --cc=stern@rowland.harvard.edu \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox