This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[patch, fortran] PR31716 segfault with real array bounds


:ADDPATCH fortran:

This patch is self explanatory and eliminates this segfault on invalid code.

Regression tested on x86-64-gnu-linux.

OK for trunk and later 4.2.1

Regards,

Jerry

2007-05-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>

	PR fortran/31716
	* array.c (spec_dimen_size): Test for correct BT_INTEGER type.
Index: array.c
===================================================================
*** array.c	(revision 124756)
--- array.c	(working copy)
*************** spec_dimen_size (gfc_array_spec *as, int
*** 1725,1731 ****
  
    if (as->type != AS_EXPLICIT
        || as->lower[dimen]->expr_type != EXPR_CONSTANT
!       || as->upper[dimen]->expr_type != EXPR_CONSTANT)
      return FAILURE;
  
    mpz_init (*result);
--- 1725,1733 ----
  
    if (as->type != AS_EXPLICIT
        || as->lower[dimen]->expr_type != EXPR_CONSTANT
!       || as->upper[dimen]->expr_type != EXPR_CONSTANT
!       || as->lower[dimen]->ts.type != BT_INTEGER
!       || as->upper[dimen]->ts.type != BT_INTEGER)
      return FAILURE;
  
    mpz_init (*result);

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