Bug 40829 - gcc.dg/vect/no-scevccp-noreassoc-outer-2.c can segv
Summary: gcc.dg/vect/no-scevccp-noreassoc-outer-2.c can segv
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 4.5.0
: P3 trivial
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-22 21:26 UTC by simon_baldwin
Modified: 2009-07-27 12:08 UTC (History)
2 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description simon_baldwin 2009-07-22 21:26:53 UTC
From gcc.dg/vect/no-scevccp-noreassoc-outer-2.c:

  6 #define N 40
  7 int a[200*N];
  8
  9 __attribute__ ((noinline)) void
 10 foo (){
 11   int i,j;
 12   int sum,s=0;
 13
 14   for (i = 0; i < 200*N; i++) {
 15     sum = 0;
 16     for (j = 0; j < N; j++) {
 17       sum += (i + j);
 18       i++;
 19     }
 20     a[i] = sum;  // i exceeds 8000, runs off array end
 21   }
 22 }

In function foo(), at line 20, variable 'i' can exceed the bounds of array 'a', and segv is possible.

The fix may be as simple as padding array 'a', provided this does not affect the other things that this test validates.
Comment 1 simon_baldwin 2009-07-27 12:08:23 UTC
Committed revision 150109.
Comment 2 hjl@gcc.gnu.org 2009-07-28 16:51:47 UTC
Subject: Bug 40829

Author: hjl
Date: Tue Jul 28 16:51:19 2009
New Revision: 150169

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150169
Log:
2009-07-28  H.J. Lu  <hongjiu.lu@intel.com>

	Backport from mainline:
	2009-07-27  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40848
	* gfortran.dg/altreturn_7.f90: New.

	2009-07-27  Simon Baldwin  <simonb@google.com>

	PR testsuite/40829
	* gcc.dg/vect/no-scevccp-noreassoc-outer-2.c: Extended array 'a'
	so that indexing no longer runs off array end.

	2009-07-24  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40822
	* gfortran.dg/char_length_16.f90: New.

Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/altreturn_7.f90
      - copied unchanged from r150168, trunk/gcc/testsuite/gfortran.dg/altreturn_7.f90
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/char_length_16.f90
      - copied unchanged from r150168, trunk/gcc/testsuite/gfortran.dg/char_length_16.f90
Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/vect/no-scevccp-noreassoc-outer-2.c