public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: edward.connell@sas.com
To: gcc-gnats@gcc.gnu.org
Subject: target/4959: gcc/s390 fails with more than 1024 function pointers
Date: Wed, 21 Nov 2001 08:36:00 -0000	[thread overview]
Message-ID: <20011127180830.13523.qmail@sourceware.cygnus.com> (raw)


>Number:         4959
>Category:       target
>Synopsis:       gcc/s390 fails with more than 1024 function pointers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 27 10:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     edward.connell@sas.com
>Release:        gcc version 2.95.3 20010315 (release)
>Organization:
>Environment:
Linux/s390 native and cross-build
>Description:
gcc fails to compile a file with more than 1024 function pointers with "/var/tmp/cc6ojHFY.s:2073: Error: operand out of range (4096 not between 0 and 4095)".  Gcc is trying to use a relative offset but the distance gets too large.  Imagine the following with N=1025.

****************
int i0();
int i1();
int i2();

int main() {
 int (*funcs[3])();

 funcs[0]=i0;
 funcs[1]=i1;
 funcs[2]=i2;
 return 0;
}
**************

This program will generate a .c file which fails to compile on s390.

**************
#define NUM 1025

int main()
{
 int i;

 for (i=0; i<NUM; i++) {
   printf("int i%d();\n", i);
 }

 printf("\nint main() {\n int (*funcs[%d])();\n\n", NUM);

 for (i=0; i<NUM; i++) {
   printf(" funcs[%d]=i%d;\n", i, i);
 }

 printf(" return 0;\n}\n");

 return 0;
}
**************
>How-To-Repeat:
#define NUM 1025

int main()
{
 int i;

 for (i=0; i<NUM; i++) {
   printf("int i%d();\n", i);
 }

 printf("\nint main() {\n int (*funcs[%d])();\n\n", NUM);

 for (i=0; i<NUM; i++) {
   printf(" funcs[%d]=i%d;\n", i, i);
 }

 printf(" return 0;\n}\n");

 return 0;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2001-11-27 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-21  8:36 edward.connell [this message]
2002-06-20 16:18 rth
2002-06-21  5:13 uweigand

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=20011127180830.13523.qmail@sourceware.cygnus.com \
    --to=edward.connell@sas.com \
    --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).