This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/63572] [5 Regression] ICF breaks user debugging experience
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 17 Oct 2014 10:12:24 +0000
- Subject: [Bug debug/63572] [5 Regression] ICF breaks user debugging experience
- Auto-submitted: auto-generated
- References: <bug-63572-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63572
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|jakub at redhat dot com |
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
struct S { int a; int b; int c; };
volatile int t;
__attribute__((noinline)) static int
f1 (struct S *x)
{
static int u = 1;
int g = x->a * 7;
t++;
{
static int v = 2;
int h = x->b * 11;
t++;
int i = x->c;
t++;
return g + h + i;
}
}
__attribute__((noinline)) static int
f2 (struct S *x)
{
static int w = 3;
int j = x->a * 7; t++; int k = x->b * 11; t++;
{
static int y = 4;
int l = x->c;
t++;
return j + k + l;
}
}
__attribute__((noinline)) int f3 (struct S *x) { return f1 (x); }
__attribute__((noinline)) int f4 (struct S *x) { return f2 (x) + 1; }
__attribute__((noinline)) int f5 (struct S *x) { return f1 (x) + 2; }
__attribute__((noinline)) int f6 (struct S *x) { return f2 (x) + 3; }
int
main ()
{
struct S s = { 1, 2, 3 };
asm volatile ("" : : "r" (&s) : "memory");
int a[4];
a[0] = f3 (&s);
a[1] = f4 (&s);
a[2] = f5 (&s);
a[3] = f6 (&s);
asm volatile ("" : : "r" (a) : "memory");
return 0;
}
Even better testcase, which actually has more executable statements, and thus
allows to inspect if one sees e.g. the u/v/w/y/g/h/i/j/k/l variables in the
scope etc.