This is the mail archive of the
mailing list for the GCC project.
Re: Aggressive load in gcc when accessing escaped pointer?
- From: Michael Matz <matz at suse dot de>
- To: Cy Cheng <cycheng dot buddhist at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 21 Mar 2016 15:51:54 +0100 (CET)
- Subject: Re: Aggressive load in gcc when accessing escaped pointer?
- Authentication-results: sourceware.org; auth=none
- References: <CAKB9r5rfUppm4LJgUHnT=q8N9dTe8JOtwS=A5Q1NhtL3GshWVg at mail dot gmail dot com> <20160318142637 dot GC312 at x4> <28502E69-8365-4753-8653-7BFFB923090E at gmail dot com> <CAKB9r5pKFm_ntHWnSHQryJpb+ZPEz1rOn=_-YTt3DXDjhYuy=w at mail dot gmail dot com>
On Sat, 19 Mar 2016, Cy Cheng wrote:
> But I don't understand why &c - 8 is invalid? Which rule in C99 it volatile?
&x points to the start of object x, and &x - something (something != 0)
points outside object x. 'c' was a complete object, so &c-8 points
outside any object, hence the formation of that pointer is already
invalid (as is its dereference).