2010-04-20 Richard Guenther <rguenther@suse.de>
Backport from mainline
2009-01-24 Jakub Jelinek <jakub@redhat.com>
PR c/38957
* c-typeck.c (c_finish_return): Handle POINTER_PLUS_EXPR the same way
as PLUS_EXPR.
* gcc.dg/pr38957.c: New test.
From-SVN: r158559
+2010-04-20 Richard Guenther <rguenther@suse.de>
+
+ Backport from mainline
+ 2009-01-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/38957
+ * c-typeck.c (c_finish_return): Handle POINTER_PLUS_EXPR the same way
+ as PLUS_EXPR.
+
2010-04-20 Richard Guenther <rguenther@suse.de>
Backport from mainline
{
case NOP_EXPR: case NON_LVALUE_EXPR: case CONVERT_EXPR:
case PLUS_EXPR:
+ case POINTER_PLUS_EXPR:
inner = TREE_OPERAND (inner, 0);
continue;
+2010-04-20 Richard Guenther <rguenther@suse.de>
+
+ Backport from mainline
+ 2009-01-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/38957
+ * gcc.dg/pr38957.c: New test.
+
2010-04-20 Richard Guenther <rguenther@suse.de>
Backport from mainline
--- /dev/null
+/* PR c/38957 */
+/* { dg-do compile } */
+
+char *
+foo (void)
+{
+ char a[2];
+ return a+1; /* { dg-warning "returns address of local variable" } */
+}
+
+char *
+bar (void)
+{
+ char a[2];
+ return a; /* { dg-warning "returns address of local variable" } */
+}