re PR c/18050 (-Wsequence-point reports false positives)

2008-08-28  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
            Andrew Pinski  <pinskia@gcc.gnu.org>

	PR 18050
	* c-common.c (verify_tree): Fix handling of ADDR_EXPR.
testsuite/
	* gcc.dg/Wsequence-point-pr18050.c: New.
	* g++.dg/warn/Wsequence-point-pr18050.C: New.

Co-Authored-By: Andrew Pinski <pinskia@gcc.gnu.org>

From-SVN: r139742
parent 5a2f8dcf
2008-08-28 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
Andrew Pinski <pinskia@gcc.gnu.org>
PR 18050
* c-common.c (verify_tree): Fix handling of ADDR_EXPR.
2008-08-28 Paolo Carlini <paolo.carlini@oracle.com>
* gtrh-posix.h: Fix uses of _POSIX_TIMEOUTS per the normal Posix
......
......@@ -2189,6 +2189,13 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp,
return;
}
case ADDR_EXPR:
x = TREE_OPERAND (x, 0);
if (DECL_P (x))
return;
writer = 0;
goto restart;
default:
/* For other expressions, simply recurse on their operands.
Manual tail recursion for unary expressions.
......
2008-08-28 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
Andrew Pinski <pinskia@gcc.gnu.org>
PR 18050
* gcc.dg/Wsequence-point-pr18050.c: New.
* g++.dg/warn/Wsequence-point-pr18050.C: New.
2008-08-28 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/37260
......
/* PR 18050 : bogus warning with -Wsequence-point */
/* { dg-do compile } */
/* { dg-options "-Wsequence-point" } */
struct x
{
int i;
};
void bar(struct x*, int *);
void foo(struct x *y)
{
bar(y++, &y->i); /* { dg-warning "operation on 'y' may be undefined" } */
}
void zz(int a, int *b)
{
*b = a;
}
void baz(void) {
int a = 5;
zz(++a, &a); /* { dg-bogus "operation on 'a' may be undefined" } */
}
/* PR 18050 : bogus warning with -Wsequence-point */
/* { dg-do compile } */
/* { dg-options "-Wsequence-point" } */
struct x
{
int i;
};
void bar(struct x*, int *);
void foo(struct x *y)
{
bar(y++, &y->i); /* { dg-warning "operation on 'y' may be undefined" } */
}
void zz(int a, int *b)
{
*b = a;
}
void baz(void) {
int a = 5;
zz(++a, &a); /* { dg-bogus "operation on 'a' may be undefined" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment