From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4100 invoked by alias); 25 Sep 2004 08:48:59 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4091 invoked by alias); 25 Sep 2004 08:48:58 -0000 Date: Sat, 25 Sep 2004 08:48:00 -0000 Message-ID: <20040925084858.4090.qmail@sourceware.org> From: "jsm at polyomino dot org dot uk" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040924231306.17665.davids@webmaster.com> References: <20040924231306.17665.davids@webmaster.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/17665] wrong code with -O2 X-Bugzilla-Reason: CC X-SW-Source: 2004-09/txt/msg03085.txt.bz2 List-Id: ------- Additional Comments From jsm at polyomino dot org dot uk 2004-09-25 08:48 ------- Subject: Re: wrong code with -O2 On Sat, 25 Sep 2004, davids at webmaster dot com wrote: > I am perfectly willing to entertain the possibility that I am being dense or > misguided, but we're talking about 'void *' here. You can't get a 'void *' by > taking the address of a 'void' and you can't dereference a 'void *' to get > a 'void'. The only use of 'void *' is for type aliasing. Look at the code quoted. You are using the same memory to store an object of type "void *" and an object of type "char *". Although those objects have the same representation and alignment requirements, this is not permitted aliasing (whereas you could, for example, use the same memory to store "int" and "unsigned int"). > The documentation for '-fstrict-aliasing' talks about an object of one type > being at the same address as an object of another type. But 'void' is not a > type of object, so I don't see that I'm violating aliasing rules. The problematic object types in your code are "void *" and "char *" (accessed by dereferencing "void **" and "char **" pointers), not "void" and "char". -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17665