From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20840 invoked by alias); 5 Dec 2004 19:11:02 -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 20813 invoked by uid 48); 5 Dec 2004 19:10:59 -0000 Date: Sun, 05 Dec 2004 19:11:00 -0000 Message-ID: <20041205191059.20812.qmail@sourceware.org> From: "felix dot nawothnig at t-online dot de" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20041205085537.18842.felix.nawothnig@t-online.de> References: <20041205085537.18842.felix.nawothnig@t-online.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug tree-optimization/18842] Weak optimization on global references X-Bugzilla-Reason: CC X-SW-Source: 2004-12/txt/msg00746.txt.bz2 List-Id: ------- Additional Comments From felix dot nawothnig at t-online dot de 2004-12-05 19:10 ------- Diagnostics? Both files are 100% valid C++ - but since the C++ standard doesn't enforce implementation of references as pointers they cause ABI-defined (?) behaviour at/after linkage, just as... extern int x; void main() { foo(); assert(x == 5); } --- float x; void foo() { x = 5; } ...isn't guaranteed to "work" either. (but is still valid C) Reading the reference over a pointer would still work because we can't remove the reference itself from the object since someone might do "extern int &y;" in another file - but it's evil. (non-portable) *And* they are guaranteed to be const by the standard. So, yes, safe to optimize. I think. :) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18842