public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* middle-end/7048: GCC fails to emit addr_diff_vec table after casesi in -O2.
@ 2002-06-16 13:24 Matt Thomas
  0 siblings, 0 replies; 3+ messages in thread
From: Matt Thomas @ 2002-06-16 13:24 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: middle-end/7048: GCC fails to emit addr_diff_vec table after casesi in -O2.
@ 2003-01-14 23:03 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2003-01-14 23:03 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, matt, rth

Synopsis: GCC fails to emit addr_diff_vec table after casesi in -O2.

State-Changed-From-To: feedback->closed
State-Changed-By: bangerth
State-Changed-When: Tue Jan 14 15:03:29 2003
State-Changed-Why:
    No feedback. Richard's patch has been applied.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7048


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: middle-end/7048: GCC fails to emit addr_diff_vec table after casesi in -O2.
@ 2002-06-19 11:41 rth
  0 siblings, 0 replies; 3+ messages in thread
From: rth @ 2002-06-19 11:41 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, matt, nobody, rth

Synopsis: GCC fails to emit addr_diff_vec table after casesi in -O2.

Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Wed Jun 19 10:16:11 2002
Responsible-Changed-Why:
    .
State-Changed-From-To: open->feedback
State-Changed-By: rth
State-Changed-When: Wed Jun 19 10:16:11 2002
State-Changed-Why:
    http://gcc.gnu.org/ml/gcc-patches/2002-06/msg01591.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7048


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-14 23:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-16 13:24 middle-end/7048: GCC fails to emit addr_diff_vec table after casesi in -O2 Matt Thomas
2002-06-19 11:41 rth
2003-01-14 23:03 bangerth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).