This is the mail archive of the gcc@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]

too big array produses SIGSEGV



I have founded a strange bug in c-decl.c which actual for AVR port.

char test1[0x8000] = {};

Compiling file with this string produces:

c.c:3: size of array `Test1' is too large
avr-gcc: Internal compiler error: program cc1 got fatal signal 11

I can't reproduce this situation for i386 port.

char test1[0x80000000] = {};

Compiled normally (No SIGSEGV only error message).

As I understands error was born in c-decl.c:4432:

	      /* If that overflowed, the array is too big.
		 ??? While a size of INT_MAX+1 technically shouldn't cause
		 an overflow (because we subtract 1), the overflow is recorded
		 during the conversion to index_type, before the subtraction.
		 Handling this case seems like an unnecessary complication.  */
	      if (TREE_OVERFLOW (itype))
		{
		  error ("size of array `%s' is too large", name);
		  type = error_mark_node;  /* IMHO this is a wrong place */
		  continue;
		}

Why this fragment exists ?
If I comment it out then gcc work normally (only error message outputed).



Really SIGSEGV produced by c-decl.c:3344 :


	if (TYPE_SIZE (TREE_TYPE (decl)) != 0)
	  {
	    /* A complete type is ok if size is fixed.  */

SIGSEGV->   if (TREE_CODE (TYPE_SIZE (TREE_TYPE (decl))) != INTEGER_CST
		|| C_DECL_VARIABLE_SIZE (decl))
	      {
		error ("variable-sized object may not be initialized");
		initialized = 0;
	      }
	  }
	else if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE)


I'm use c-decl.c CVS:1.91

Denis.


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