C gcc-3.0 compiler crash

Nicola Pero n.pero@mi.flashnet.it
Wed Mar 7 15:17:00 GMT 2001


Hi - while trying to build a testcase for some [obscure] Objective-C code
I have which crashes gcc-3.0, I realized the whole thing does not seem
particularly Objective-C specific, as the C compiler crashes as well.

leonardo:~/gcc-3.0/gcc/testsuite/objc/execute$ gcc nested-3.c
/tmp/ccSXG4Kj.o: In function `test_function':
/tmp/ccSXG4Kj.o(.text+0x5a): undefined reference to `nested.0'
collect2: ld returned 1 exit status
leonardo:~/gcc-3.0/gcc/testsuite/objc/execute$ 

leonardo:~/gcc-3.0/gcc/testsuite/objc/execute$ gcc -DVARIANT nested-3.c
nested-3.c: In function `test_function':
nested-3.c:33: Internal compiler error in assign_stack_temp_for_type, at
function.c:663
Please submit a full bug report, with preprocessed source if appropriate.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.
leonardo:~/gcc-3.0/gcc/testsuite/objc/execute$ 



int test_function (int argument)
{
  typedef struct 
    {
      int val[argument];
    } block;

  inline block nested ()
    {
      unsigned i;
      block result;

      for (i = 0; i < argument; i++)
	{
	  result.val[i] = i + 1;
	}

      return result;
    }

#ifndef VARIANT

  block result;

  result = nested ();
  return result.val[0];

#else /* Compile with -DVARIANT to get a different compiler crash */

  return (nested ()).val[0]; 

#endif
}

int main (void)
{
  if (test_function (5) != 1)
    {
      abort ();
    }

  return 0;
}





More information about the Gcc-bugs mailing list