From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32476 invoked by alias); 6 Dec 2004 23:32:00 -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 32465 invoked by uid 48); 6 Dec 2004 23:31:56 -0000 Date: Mon, 06 Dec 2004 23:32:00 -0000 Message-ID: <20041206233156.32464.qmail@sourceware.org> From: "amodra at bigpond dot net dot au" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20041013124723.17972.mostrows@watson.ibm.com> References: <20041013124723.17972.mostrows@watson.ibm.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/17972] [3.4 Regression] const/pure functions result in bad asm X-Bugzilla-Reason: CC X-SW-Source: 2004-12/txt/msg00912.txt.bz2 List-Id: ------- Additional Comments From amodra at bigpond dot net dot au 2004-12-06 23:31 ------- I checked again with a current x86 gcc, 3.4.4 20041206, and the problem is still there. Note that this only happens with cc1plus. As to why we get the "impossible" assembly, what happens is that the inline function cti gets expanded twice, but the first return label is used for both expansions: cti body jump ret_label ret_label cti body jump ret_label A simpler testcase is: struct thread_info { short preempt_count; } x; static inline struct thread_info *cti (void) __attribute__ ((const)); static inline struct thread_info *cti (void) { return &x; } void fn (void) { ++cti()->preempt_count; } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17972