public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Nick Macdonald" <macdonn@nortelnetworks.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c/10143: Post increment doesn work more than once per statement Date: Wed, 19 Mar 2003 19:56:00 -0000 [thread overview] Message-ID: <20030319195601.26038.qmail@sources.redhat.com> (raw) The following reply was made to PR c/10143; it has been noted by GNATS. From: "Nick Macdonald" <macdonn@nortelnetworks.com> To: "Joseph S. Myers" <jsm28@cam.ac.uk> Cc: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>, gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org Subject: Re: c/10143: Post increment doesn work more than once per statement Date: Wed, 19 Mar 2003 14:54:29 -0500 Good point... I did not see that recommendation, however, even if I had.... check this: {macdonn}85: which gcc /opt/unsupported/gcc-2.95.2/bin/gcc {macdonn}86: gcc -Wall shift.c shift.c: In function `main': shift.c:67: warning: unsigned int format, long unsigned int arg (arg 4) shift.c:68: warning: unsigned int format, long unsigned int arg (arg 4) shift.c:70: warning: unsigned int format, long unsigned int arg (arg 4) shift.c:71: warning: unsigned int format, long unsigned int arg (arg 3) shift.c:72: warning: unsigned int format, long unsigned int arg (arg 4) {macdonn}87: gcc -Wsequence-point shift.c cc1: Invalid option `-Wsequence-point' {macdonn}193: gcc -Wall WeirdForLoop.c {macdonn}194: gcc -v Reading specs from /tmp/gcc_install/lib/gcc-lib/sparc-sun-solaris2.8/3.2.2/specs Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls --prefix=/tmp/gcc_install Thread model: posix gcc version 3.2.2 {macdonn}195: gcc -Wsequence-point WeirdForLoop.c There is no sequence point warning when compiling either program... using either 2.95.2 or 3.2.2 As for your questions... I submitted by bug by starting from this URL: http://www.gnu.org/directory/gcc.html which led to this URL: http://www.gnu.org/software/gcc/gnats.html which led to this URL: http://gcc.gnu.org/cgi-bin/gnatsweb.pl and no where along that path did I see the recommendationabout warnings (even though in this case that would not have helped.) A person comment on all this: I was just trying to make the product better... I feel the answer of "not a bug" to be a bit pedantic... sure, technically it may not be a bug... however, logically, the current behaviour is less than stellar and it should be addressed to make post and pre increment behave more or less similarly... I have learned a valuable lesson from all this, and I will now write better code because of it... but I still think that the choice of implementing this behaviour in the chosen manner is highly likely to make a bad problem much more seriously wrong than it should be. (If the evil empire can do something meaningful with it... we should be able to learn from that...) If this bizarre code generating behaviour is to stand as is then I'd rather the compiler default to warning on this behaviour than to make it my requirement to know that I should request a sequence point warning... i.e. default the warning on and make it a requirement to supress it. Nick "Joseph S. Myers" wrote: > > On 19 Mar 2003, Falk Hueffner wrote: > > > > (Is there a FAQ entry somewhere that deals with this issue?) > > > > See the documentation of -Wsequence-point. (We should probably add > > this to the list of C non-bugs...) > > The bug reporting instructions <http://gcc.gnu.org/bugs.html> say: > > Before reporting that GCC compiles your code incorrectly, please > compile it with gcc -Wall and see whether this shows anything wrong > with your code that could be the cause instead of a bug in GCC. > > To the submitter: did you see this part of the instructions and try > compiling your code with -Wall (which includes -Wsequence-point, which > would have shown up the problem with the code)? If not, how could we > improve the documentation of how to submit bugs so that you would have > seen and followed these instructions? If you did use -Wall, how could we > clarify the warning message? > > -- > Joseph S. Myers > jsm28@cam.ac.uk -- Nick MacDonald Nortel Networks, Belleville macdonn@nortelnetworks.com (613) 966-0100 Ext. 8755 ESN: 343-8755
next reply other threads:[~2003-03-19 19:56 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-19 19:56 Nick Macdonald [this message] -- strict thread matches above, loose matches on Subject: below -- 2003-03-20 0:16 Neil Booth 2003-03-19 22:36 Nick Macdonald 2003-03-19 20:16 Joseph S. Myers 2003-03-19 19:06 Joseph S. Myers 2003-03-19 14:26 Falk Hueffner 2003-03-19 14:06 Nick Macdonald 2003-03-19 7:10 neil 2003-03-19 1:06 macdonn
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=20030319195601.26038.qmail@sources.redhat.com \ --to=macdonn@nortelnetworks.com \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@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: linkBe 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).