This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
target/4959: gcc/s390 fails with more than 1024 function pointers
- From: edward dot connell at sas dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 27 Nov 2001 18:08:30 -0000
- Subject: target/4959: gcc/s390 fails with more than 1024 function pointers
- Reply-to: edward dot connell at sas dot com
[Get raw message]
>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: