summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Warray-bounds-5.c
diff options
context:
space:
mode:
authorjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-05 16:06:38 +0000
committerjamborm <jamborm@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-05 16:06:38 +0000
commit82271e4c6065813b114fa515b7cca47f90321937 (patch)
tree519533d92b35a2c870dadff443e7d0905b988f61 /gcc/testsuite/gcc.dg/Warray-bounds-5.c
parentbab4625684bc524d751b0bbb3a4c2492aa22c807 (diff)
downloadgcc-82271e4c6065813b114fa515b7cca47f90321937.tar.gz
2008-11-05 Martin Jambor <mjambor@suse.cz>
PR middle-end/37861 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Don't turn pointer arithmetics into array_ref if the array is accessed through an indirect_ref. * testsuite/gcc.dg/Warray-bounds-5.c: New file. * testsuite/gcc.dg/Warray-bounds-6.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141613 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/Warray-bounds-5.c')
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-5.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-5.c b/gcc/testsuite/gcc.dg/Warray-bounds-5.c
new file mode 100644
index 00000000000..ba9cd2aa03f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-5.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -Wall" } */
+/* based on PR 37861 */
+
+extern int printf (__const char *__restrict __format, ...);
+
+static int f2(char formatstr[10][100])
+{
+ int anz;
+ for( anz = 0; anz < 10; ++anz ) {
+ printf( "%d %s\n", anz, formatstr[anz] );
+ }
+ return anz;
+}
+
+
+static char formatstr[10][100];
+int main( void )
+{
+ int anz;
+ anz = f2(formatstr);
+ printf( " %d\n",anz);
+ return 0;
+}