This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/36879] New: [4.4 Regression] undefined reference to a variable
- From: "pinskia 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 Jul 2008 21:53:15 -0000
- Subject: [Bug tree-optimization/36879] New: [4.4 Regression] undefined reference to a variable
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Take the following testcase:
typedef unsigned int u32;
static const u32 deadfish = 0xdeadf155;
static const u32 cfb_tab8_be[] = {
0x00000000,0x000000ff,0x0000ff00,0x0000ffff,
0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff,
0xff000000,0xff0000ff,0xff00ff00,0xff00ffff,
0xffff0000,0xffff00ff,0xffffff00,0xffffffff
};
static const u32 cfb_tab8_le[] = {
0x00000000,0xff000000,0x00ff0000,0xffff0000,
0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00,
0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff,
0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff
};
static const u32 cfb_tab16_be[] = {
0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
};
static const u32 cfb_tab16_le[] = {
0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
};
static const u32 cfb_tab32[] = {
0x00000000, 0xffffffff
};
const u32 *xxx(int bpp)
{
const u32 *tab;
if (0) return &deadfish;
switch (bpp) {
case 8:
tab = cfb_tab8_be;
break;
case 16:
tab = cfb_tab16_be;
break;
case 32:
default:
tab = cfb_tab32;
break;
}
return tab;
}
int main(void)
{
const u32 *a = xxx(8);
int b = a[0];
if (b != cfb_tab8_be[0])
__builtin_abort ();
return 0;
}
-- CUT ---
Currently at -O2, we will get an undefined symbol:
/tmp/ccuZc5eC.o:(.data+0x20): undefined reference to `cfb_tab16_be'
collect2: ld returned 1 exit status
This is caused by switch-conversion pass.
--
Summary: [4.4 Regression] undefined reference to a variable
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: link-failure
Severity: blocker
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36879