public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Matt Thomas <matt@pilot.local>
To: gcc-gnats@gcc.gnu.org
Subject: middle-end/7048: GCC fails to emit addr_diff_vec table after casesi in -O2.
Date: Sun, 16 Jun 2002 13:24:00 -0000	[thread overview]
Message-ID: <200206161956.g5GJuwR18298@pilot.local> (raw)


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


             reply	other threads:[~2002-06-16 20:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-16 13:24 Matt Thomas [this message]
2002-06-19 11:41 rth
2003-01-14 23:03 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200206161956.g5GJuwR18298@pilot.local \
    --to=matt@pilot.local \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).