public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] PR31716 segfault with real array bounds
@ 2007-05-19  0:29 Jerry DeLisle
  2007-05-19  9:30 ` Thomas Koenig
  0 siblings, 1 reply; 2+ messages in thread
From: Jerry DeLisle @ 2007-05-19  0:29 UTC (permalink / raw)
  To: Fortran List; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 319 bytes --]

: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.

[-- Attachment #2: pr31716.diff --]
[-- Type: text/x-patch, Size: 731 bytes --]

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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-19  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-19  0:29 [patch, fortran] PR31716 segfault with real array bounds Jerry DeLisle
2007-05-19  9:30 ` Thomas Koenig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).