This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/41340] [4.5 Regression] G++ produces different code with and without -g option
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Oct 2009 17:05:02 -0000
- Subject: [Bug debug/41340] [4.5 Regression] G++ produces different code with and without -g option
- References: <bug-41340-16926@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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