From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16359 invoked by alias); 18 Oct 2004 22:45:53 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 16211 invoked by uid 48); 18 Oct 2004 22:45:51 -0000 Date: Mon, 18 Oct 2004 22:45:00 -0000 Message-ID: <20041018224551.16209.qmail@sourceware.org> From: "pinskia at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20041018215708.18050.mitr@volny.cz> References: <20041018215708.18050.mitr@volny.cz> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/18050] -Wsequence-point reports false positives X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg02455.txt.bz2 List-Id: ------- 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