This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
middle-end/7048: GCC fails to emit addr_diff_vec table after casesi in -O2.
- From: Matt Thomas <matt at pilot dot local>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Sun, 16 Jun 2002 12:56:58 -0700 (PDT)
- Subject: middle-end/7048: GCC fails to emit addr_diff_vec table after casesi in -O2.
>Number: 7048
>Category: middle-end
>Synopsis: GCC fails to emit addr_diff_vec table after casesi in -O2.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Sun Jun 16 13:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Matt Thomas
>Release: 3.2 20020615 (experimental)
>Organization:
3am Software Foundry
>Environment:
System: NetBSD pilot.local 1.5ZC NetBSD 1.5ZC (PILOT) #59: Sat May 18 12:43:46 PDT 2002 matt@pilot.local:/export/i386/kobj/PILOT i386
host: i386-unknown-netbsdelf1.5ZC
build: i386-unknown-netbsdelf1.5ZC
target: vax-dec-netbsdelf
configured with: /export/toolchain/gcc/configure --enable-static --disable-shared --target=vax-netbsdelf : (reconfigured) : (reconfigured)
>Description:
When compiling C source with a switch statement, depending on the
complexity of the switch cases, the addr_diff_vec table is sometimes
omitted when compiling -O2.
>How-To-Repeat:
Compile the following with -O2 and examine the resultant .s file;
notice the missing addr_diff_vec table:
__asm__(".section " ".ident" " ; .asciz \"" "$NetBSD: sysconf.c,v 1.14 2002/01/31 00:32:47 kleink Exp $" "\" ; .text");
typedef long long int __int64_t;
typedef __int64_t quad_t;
typedef quad_t rlim_t;
typedef unsigned int u_int;
typedef unsigned long int size_t;
int _sysctl (int *, u_int, void *, size_t *, const void *, size_t);
struct rlimit {
rlim_t rlim_cur;
rlim_t rlim_max;
};
int getrlimit (int, struct rlimit *);
int *__errno (void);
long
__sysconf(name)
int name;
{
struct rlimit rl;
size_t len;
int mib[2], value;
len = sizeof(value);
switch (name) {
case 1:
mib[0] = 1;
mib[1] = 8;
break;
case 2:
return (getrlimit(7, &rl) ? -1 : (long)rl.rlim_cur);
case 3:
return (100);
case 6:
mib[0] = 1;
mib[1] = 19;
goto yesno;
case 4:
mib[0] = 1;
mib[1] = 18;
break;
case 5:
return (getrlimit(8, &rl) ? -1 : (long)rl.rlim_cur);
case 26:
mib[0] = 8;
mib[1] = 19;
break;
case 27:
mib[0] = 8;
mib[1] = 20;
break;
case 7:
mib[0] = 1;
mib[1] = 20;
goto yesno;
case 8:
mib[0] = 1;
mib[1] = 17;
break;
case 28:
mib[0] = 6;
mib[1] = 7;
break;
case 29:
mib[0] = 1;
mib[1] = 32;
goto yesno;
case 31:
mib[0] = 1;
mib[1] = 37;
goto yesno;
case 33:
mib[0] = 1;
mib[1] = 40;
goto yesno;
case 34:
mib[0] = 1;
mib[1] = 41;
goto yesno;
case 35:
mib[0] = 1;
mib[1] = 42;
goto yesno;
case 36:
mib[0] = 1;
mib[1] = 43;
goto yesno;
case 38:
mib[0] = 1;
mib[1] = 60;
goto yesno;
case 37:
mib[0] = 1;
mib[1] = 44;
break;
case 9:
mib[0] = 8;
mib[1] = 2;
break;
case 10:
mib[0] = 8;
mib[1] = 3;
break;
case 11:
mib[0] = 8;
mib[1] = 4;
break;
case 12:
mib[0] = 8;
mib[1] = 5;
break;
case 13:
mib[0] = 8;
mib[1] = 6;
break;
case 14:
mib[0] = 8;
mib[1] = 7;
break;
case 15:
mib[0] = 8;
mib[1] = 8;
break;
case 16:
mib[0] = 8;
mib[1] = 9;
break;
case 17:
mib[0] = 8;
mib[1] = 10;
break;
case 18:
mib[0] = 8;
mib[1] = 11;
goto yesno;
case 19:
mib[0] = 8;
mib[1] = 12;
goto yesno;
case 20:
mib[0] = 8;
mib[1] = 13;
goto yesno;
case 21:
mib[0] = 8;
mib[1] = 14;
goto yesno;
case 22:
mib[0] = 8;
mib[1] = 15;
goto yesno;
case 23:
mib[0] = 8;
mib[1] = 16;
goto yesno;
case 24:
mib[0] = 8;
mib[1] = 17;
goto yesno;
case 25:
mib[0] = 8;
mib[1] = 18;
goto yesno;
case 32:
mib[0] = 1;
mib[1] = 38;
break;
case 30:
mib[0] = 1;
mib[1] = 35;
yesno: if (_sysctl(mib, 2, &value, &len, 0, 0) == -1)
return (-1);
if (value == 0)
return (-1);
return (value);
break;
default:
(*__errno()) = 22;
return (-1);
}
return (_sysctl(mib, 2, &value, &len, 0, 0) == -1 ? -1 : value);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: