[Bug c/18050] -Wsequence-point reports false positives
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Oct 18 22:45:00 GMT 2004
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-18 22:45 -------
Actually the patch will not work when we start warning about full expression, here is the patch just to
give an example of what the final patch would look like:
Index: c-common.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.578
diff -u -p -r1.578 c-common.c
--- c-common.c 16 Oct 2004 22:58:45 -0000 1.578
+++ c-common.c 18 Oct 2004 22:42:30 -0000
@@ -1358,6 +1358,16 @@ verify_tree (tree x, struct tlist **pbef
add_tlist (pno_sp, t->cache_after_sp, NULL_TREE, 1);
return;
}
+
+ case ADDR_EXPR:
+ {
+ x = TREE_OPERAND (x, 0);
+ if (DECL_P (x))
+ return;
+ writer = 0;
+ goto restart;
+ }
+ return;
default:
/* For other expressions, simply recurse on their operands.
Here is the test which I was taking about:
struct x
{
int i;
};
void g(int, int *);
void f(struct x *y)
{
g(y->i++, &y->i); /* {dg-bogus "undefined" } */
}
Here is another where we should warn:
struct x
{
int i;
};
void g(int, int *);
void f(struct x *y)
{
g((y++)->i, &y->i); /* { dg-warning "undefined" } */
}
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|pinskia at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18050
More information about the Gcc-bugs
mailing list