Bug 98728 - gcc internal compiler error encountered
gcc internal compiler error encountered
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2003-07-07 21:06 EDT by Mike Rubel
Modified: 2011-11-22 02:34 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-07-08 05:05:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mike Rubel 2003-07-07 21:06:25 EDT
Description of problem:

Encountered "Internal compiler error," following instruction to submit to bugzilla.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Save the file compiler_error.c (about 30 lines), given below.
2. Compile it with gcc -Wall -o compiler_error compiler_error.c ; works
3. Compile it with gcc -Wall -O3 -o compiler_error compiler_error.c ;
   generates internal compiler error message.
Actual results:

$ gcc -Wall -O3 -o compiler_error compiler_error.c
compiler_error.c: In function `main':
compiler_error.c:17: Internal compiler error in find_function_data, at
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.

Expected results:

Normal compilation.

Additional info:

Here is a test code which demonstrates the problem.  Contorted example, I know,
but should be legal in gcc.

--------------->8 compiler_error.c 8<-----------------
#include <stdio.h>
static void *fcn;
static int arg_length;
static char buf[2048];

void simple_test_function(int a, int b)
  printf("a: %d, b:%d\n", a, b);

void RunFunction(void)
  struct arglen_buf_s { char buf[arg_length]; };
  void (*f)() = (void *) fcn;
  (void) f( *(struct arglen_buf_s *) buf );

int main(void)
  int *args_ptr;
  fcn = (void *) simple_test_function;

  arg_length = 2 * sizeof(int);
  args_ptr = (void *) buf;
  args_ptr[0] = 5;
  args_ptr[1] = 7;


  return 0;
Comment 1 Jakub Jelinek 2003-07-08 05:05:21 EDT
This is certainly not legal ISO C.
You cannot call a function with a different arguments than it accepts.
And even without inlining this will not work on most architectures
(very likely will not work on any 64-bit architecture, on any architecture
which passes structures by reference or where integers are passed in different
location than variable length aggregates).
It is true that gcc should not ICE on any input, just issue diagnostics,
but I really have no interest in fixing this exact case. File a PR on gcc.gnu.org
if you want the ICE to be fixed.
If you want to keep this ugly hack and don't care it is basically IA-32 only hack,
you either need to add __attribute__((noinline)) somewhere or force gcc to forget
what fn points to (say with asm ("" : "=r" (f) : "0" (f));).
Comment 2 Jakub Jelinek 2003-07-08 05:07:23 EDT
Oh, and have a look at libffi (included in GCC sources), this is a library
which does what you are trying to do, in both directions and for lots of

Note You need to log in before you can comment on or make changes to this bug.