From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22512 invoked by alias); 2 Jul 2005 22:07:53 -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 22500 invoked by uid 48); 2 Jul 2005 22:07:48 -0000 Date: Sat, 02 Jul 2005 22:07:00 -0000 Message-ID: <20050702220748.22499.qmail@sourceware.org> From: "gcc2eran at tromer dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050702164323.22278.olivier.baudron@m4x.org> References: <20050702164323.22278.olivier.baudron@m4x.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/22278] gcc -O2 discards cast to volatile X-Bugzilla-Reason: CC X-SW-Source: 2005-07/txt/msg00212.txt.bz2 List-Id: ------- Additional Comments From gcc2eran at tromer dot org 2005-07-02 22:07 ------- Prior versions of gcc did "respect" casts to pointer-to-volatile and did not optimize away the access. I've seen a lot of code that relies on that, and which would thus be broken by gcc 4.x (in a subtle and hard-to-debug way). One recent example is an elusive bug in Fedora Core 4's X.org package which bit many users (https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=161242). I can't imagine a programmer casting into a pointer to volatile without really meaning it, so if the behavior is not defined by the standard then both compatibility and the principle of least astonishment seem to suggest reverting to the old behavior. -- What |Removed |Added ---------------------------------------------------------------------------- CC| |gcc2eran at tromer dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22278