+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.
+
2008-11-05 Richard Guenther <rguenther@suse.de>
PR middle-end/37742
+2008-11-05 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/37861
+ * gcc.dg/Warray-bounds-5.c: New test.
+ * gcc.dg/Warray-bounds-6.c: New test.
+
2008-11-05 Fabien Chene <fabien.chene@gmail.com>
PR c++/32519
--- /dev/null
+/* { 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;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O3 -Wall" } */
+/* based on PR 37861 */
+
+extern int printf (__const char *__restrict __format, ...);
+
+static int f3(int v)
+{
+ int i,j = 0;
+ for (i = 0; i <= v; i++)
+ j++;
+ return j;
+}
+
+static int f2(char formatstr[10][100]) {
+ printf( "%d %s\n", 0, formatstr[f3(0)] );
+ printf( "%d %s\n", 1, formatstr[f3(1)] );
+ printf( "%d %s\n", 2, formatstr[f3(2)] );
+ printf( "%d %s\n", 3, formatstr[f3(3)] );
+ return 3;
+}
+
+static char formatstr[10][100];
+int main( void ) {
+ int anz;
+ anz = f2(formatstr);
+ printf( " %d\n",anz);
+ return 0;
+}
array_ref = TREE_OPERAND (def_rhs, 0);
if (TREE_CODE (array_ref) != ARRAY_REF
|| TREE_CODE (TREE_TYPE (TREE_OPERAND (array_ref, 0))) != ARRAY_TYPE
+ /* Avoid accessing hidden multidimensional arrays in this way or VRP
+ might give out bogus warnings (see PR 37861) */
+ || TREE_CODE (TREE_OPERAND (array_ref, 0)) == INDIRECT_REF
|| !integer_zerop (TREE_OPERAND (array_ref, 1)))
return false;