From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8849 invoked by alias); 19 Oct 2009 17:05:17 -0000 Received: (qmail 7136 invoked by uid 48); 19 Oct 2009 17:05:02 -0000 Date: Mon, 19 Oct 2009 17:05:00 -0000 Message-ID: <20091019170502.7135.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug debug/41340] [4.5 Regression] G++ produces different code with and without -g option In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg01665.txt.bz2 ------- Comment #7 from jakub at gcc dot gnu dot org 2009-10-19 17:05 ------- Confirmed, for -m32 -march=i686 -O3 -g vs. -g0 generates different code on: typedef struct { int t; } *T; struct S1 { unsigned s1; }; struct S2 { struct S1 s2; }; struct S3 { unsigned s3; struct S2 **s4; }; struct S5 { struct S2 *s5; }; extern void fn0 (void) __attribute__ ((__noreturn__)); T fn6 (struct S3); void fn7 (void); int fn1 (const struct S1 *x) { return x->s1; } int fn2 (const struct S1 *x, unsigned y) { if (y >= x->s1) fn0 (); return 0; } int fn3 (struct S3 x) { return (x.s3 == fn1 (*x.s4 ? &(*x.s4)->s2 : 0)); } int fn4 (struct S3 x) { return fn2 (&(*x.s4)->s2, x.s3); } int fn5 (struct S3 x, T *y) { if (!fn3 (x)) { *y = (T) (long) fn4 (x); return 1; } return 0; } void test (struct S5 *x) { struct S3 a; T b; unsigned char c = 0; a.s4 = &x->s5; while (fn5 (a, &b)) if (!(b->t & 8)) c = 1; a.s4 = &x->s5; while ((b = fn6 (a))) ; if (!c) fn7 (); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41340