This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/4065: Field out of range. (Big switch causes compilation failure)



>Number:         4065
>Category:       c
>Synopsis:       Field out of range. (Big switch causes compilation failure)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 20 10:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     bruno@fc.hp.com
>Release:        gcc 2.95.2, gcc 3.0
>Organization:
>Environment:
HP-UX 10.20
>Description:
We get an assembler error of the form
Error: Field out of range [-262144..262143] (640184)
>From the gas sources this is due to a branch offset
being too large.
It looks like the compiler tries to generate too big a
branch offset in a big switch (or large function ?)
>How-To-Repeat:
Compile and run the attached program. This generates a
C source code with a switch that has n cases, n being the
argument you gave to the attached program.
Redirect the output to a file (say t.c) and compile t.c
Both gcc and g++ fail.
n=10000 causes the error message.
n=7000 causes a different error.

We found the bug on a Bison generated file.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="doit.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="doit.c"

I2luY2x1ZGUgPHN0ZGxpYi5oPgojaW5jbHVkZSA8c3RkaW8uaD4KCm1haW4oaW50IGFyZ2MsIGNo
YXIgKmFyZ3ZbXSkKewogICAgaW50IGk7CiAgICAKICAgIGlmKGFyZ2MgPCAyKQogICAgewoJZnBy
aW50ZihzdGRlcnIsICJ1c2FnZTogJXMgbnVtXG4iLCBhcmd2WzBdKTsKCWV4aXQoMSk7CiAgICB9
CgogICAgcHJpbnRmKCIjaW5jbHVkZSA8c3RkaW8uaD5cbiIpOwogICAgcHJpbnRmKCJtYWluKGlu
dCBhcmdjLCBjaGFyICphcmd2W10pXG4iKTsKICAgIHByaW50ZigieyIpOwogICAgcHJpbnRmKCIg
ICBpbnQgaTtcbiIpOwogICAgcHJpbnRmKCJzd2l0Y2goaSlcbntcbiIpOwoKICAgIGZvcihpID0g
MDsgaSA8IGF0b2koYXJndlsxXSk7IGkrKykKICAgIHsKCXByaW50ZigiY2FzZSAlZDoge1xuIiwg
aSk7CglwcmludGYoImlmKCVkICUgMikgcHJpbnRmKFwiaSBpcyBvZGRcXG5cIik7IiwgaSk7Cglw
cmludGYoIlxuZWxzZSBwcmludGYoXCJpIGlzIGV2ZW5cXG5cIik7Iik7CglwcmludGYoImJyZWFr
O1xufVxuIik7CiAgICB9CiAgICBwcmludGYoIn1cbn1cbiIpOwp9Cg==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]