public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: fritz@intrinsity.com
To: gcc-gnats@gcc.gnu.org
Subject: c/3074: Statement with no effect not flagged with -Wall
Date: Thu, 07 Jun 2001 07:56:00 -0000	[thread overview]
Message-ID: <20010607145104.26288.qmail@sourceware.cygnus.com> (raw)

>Number:         3074
>Category:       c
>Synopsis:       Statement with no effect not flagged with -Wall
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 07 07:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Fritz Boehm
>Release:        gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
>Organization:
>Environment:
Red Hat Linux 7.1
>Description:
This bug has to do with some statements with no effect going undetected
by gcc.  The line on line 4 of bug.c should (I believe) be flagged as
a statement with no effect when run with -Wall.  I munged the statement
in two different ways (lines 5 and 6) which are correctly reported as 
statements with no effect.

I have access to two linux boxes with different revisions of g++.  Both
yield the same results:



<fritz @ schrems.eng.evsx.com> 1491% gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

<fritz @ schrems.eng.evsx.com> 1492% gcc -c bug.c -Wall
bug.c: In function `main':
bug.c:5: warning: statement with no effect
bug.c:6: warning: statement with no effect




<fritz @ lott.eng.evsx.com> 10% gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)

<fritz @ lott.eng.evsx.com> 11% gcc -c -Wall bug.c 
bug.c: In function `main':
bug.c:5: warning: statement with no effect
bug.c:6: warning: statement with no effect



Another aspect that you might find interesting - there is assembly
code generated for the apparently dead code at line 4.  I'm not an
x86 assembly wizard so I can't tell you what the code does, but there
is extra code generated.

I hope this helps.  Feel free to email me with any questions.  This is
the first bug I've submitted for GNU tools (which I make use of extensively)
so I hope I'm providing good feedback.
>How-To-Repeat:
gcc -c -Wall bug.c
>Fix:
Don't enter statements that have no effect  :-D
>Release-Note:
>Audit-Trail:
>Unformatted:
 
----gnatsweb-attachment----
Content-Type: application/x-tar; name="bug.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug.tar.gz"

H4sIALaNHzsAA+3UyWrDMBQFUG2tr7ikm7jQ5CnysDCh36KE1GhRFVSbQod/r5yEFkKHtGAXyj0b
yfAeErKuNn272KpxiRGpKlGSlLbaj2LsYUxWtVFSW6mL2ha2HOrTTEFG3tdef9+5CKib6LvHL+p2
oZ1iO1PzocOt82Ge6yc9fLhGZyUuMXdYr2FyPB+nq7zBu+US4Q4PLgYfWlxh07fXp40fdqbGY5fO
vlnjpFxncdf1MUAa/aL/+uD+ifTfFn7kNQ75Lz7PfyFv+S/FMP8TuoDBbLgE25n+7VuAs4KPs/IO
xpyIiIiIiIiIiIiIiIiIiIjoR14BuO1YcQAoAAA=


             reply	other threads:[~2001-06-07  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-07  7:56 fritz [this message]
2003-05-08  8:46 Dara Hazeghi

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=20010607145104.26288.qmail@sourceware.cygnus.com \
    --to=fritz@intrinsity.com \
    --cc=gcc-gnats@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).