public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/18050] -Wsequence-point reports false positives
Date: Mon, 18 Oct 2004 22:45:00 -0000	[thread overview]
Message-ID: <20041018224551.16209.qmail@sourceware.org> (raw)
In-Reply-To: <20041018215708.18050.mitr@volny.cz>


------- 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


  parent reply	other threads:[~2004-10-18 22:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-18 21:57 [Bug c/18050] New: " mitr at volny dot cz
2004-10-18 22:01 ` [Bug c/18050] " pinskia at gcc dot gnu dot org
2004-10-18 22:15 ` giovannibajo at libero dot it
2004-10-18 22:25 ` pinskia at gcc dot gnu dot org
2004-10-18 22:35 ` pinskia at gcc dot gnu dot org
2004-10-18 22:45 ` pinskia at gcc dot gnu dot org [this message]
     [not found] <bug-18050-4370@http.gcc.gnu.org/bugzilla/>
2006-03-22 12:19 ` rguenth at gcc dot gnu dot org
2006-03-22 12:26 ` joseph at codesourcery dot com
2006-03-22 12:53 ` rguenth at gcc dot gnu dot org
2006-03-22 13:08 ` schwab at suse dot de
2008-08-27 19:46 ` pinskia at gcc dot gnu dot org
2008-08-28  1:20 ` manu at gcc dot gnu dot org
2008-08-28  1:23 ` pinskia at gcc dot gnu dot org
2008-08-28  1:31 ` manu at gcc dot gnu dot org
2008-08-29  0:09 ` manu at gcc dot gnu dot org
2008-08-29  0:10 ` manu at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041018224551.16209.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).