public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/32587]  New: gcc fails to issue "warning: suggest parentheses around assignment used as truth value"
@ 2007-07-02 15:20 fritz at intrinsity dot com
  2010-02-21  0:21 ` [Bug c/32587] " manu at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fritz at intrinsity dot com @ 2007-07-02 15:20 UTC (permalink / raw)
  To: gcc-bugs

This c code:

// begin ok.c
int bar(int a, int b, int c)
{
    //if ((b = c) && (a == 0))
    if (b = c)
        {
        return 0;
        }
    return 1;
}
// end ok.c

When compiled with 

gcc -Wall -c ok.c

issues this warning:

ok.c: In function `bar':
ok.c:5: warning: suggest parentheses around assignment used as truth value

That is what I expect.

This code, however does not issue the warning:
// begin bad.c
int bar(int a, int b, int c)
{
    if ((b = c) && (a == 0))
        {
        return 0;
        }
    return 1;
}
// end bad.c

gcc -Wall -c bad.c

(no output)


-- 
           Summary: gcc fails to issue "warning: suggest parentheses around
                    assignment used as truth value"
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fritz at intrinsity dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32587


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/32587] gcc fails to issue "warning: suggest parentheses around assignment used as truth value"
  2007-07-02 15:20 [Bug c/32587] New: gcc fails to issue "warning: suggest parentheses around assignment used as truth value" fritz at intrinsity dot com
@ 2010-02-21  0:21 ` manu at gcc dot gnu dot org
  2010-02-21  0:31 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-21  0:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from manu at gcc dot gnu dot org  2010-02-21 00:21 -------
Confirmed in GCC 4.5

This whole business with the parenthesis to avoid warning in this case always
seemed fishy to me.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-02-21 00:21:29
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32587


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/32587] gcc fails to issue "warning: suggest parentheses around assignment used as truth value"
  2007-07-02 15:20 [Bug c/32587] New: gcc fails to issue "warning: suggest parentheses around assignment used as truth value" fritz at intrinsity dot com
  2010-02-21  0:21 ` [Bug c/32587] " manu at gcc dot gnu dot org
@ 2010-02-21  0:31 ` manu at gcc dot gnu dot org
  2010-02-21  0:33 ` manu at gcc dot gnu dot org
  2010-02-21  0:33 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-21  0:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2010-02-21 00:31 -------


*** This bug has been marked as a duplicate of 32614 ***


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32587


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/32587] gcc fails to issue "warning: suggest parentheses around assignment used as truth value"
  2007-07-02 15:20 [Bug c/32587] New: gcc fails to issue "warning: suggest parentheses around assignment used as truth value" fritz at intrinsity dot com
  2010-02-21  0:21 ` [Bug c/32587] " manu at gcc dot gnu dot org
  2010-02-21  0:31 ` manu at gcc dot gnu dot org
@ 2010-02-21  0:33 ` manu at gcc dot gnu dot org
  2010-02-21  0:33 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-21  0:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2010-02-21 00:33 -------


*** This bug has been marked as a duplicate of 25733 ***


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32587


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/32587] gcc fails to issue "warning: suggest parentheses around assignment used as truth value"
  2007-07-02 15:20 [Bug c/32587] New: gcc fails to issue "warning: suggest parentheses around assignment used as truth value" fritz at intrinsity dot com
                   ` (2 preceding siblings ...)
  2010-02-21  0:33 ` manu at gcc dot gnu dot org
@ 2010-02-21  0:33 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-02-21  0:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2010-02-21 00:32 -------
wrong duplicate


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32587


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-21  0:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-02 15:20 [Bug c/32587] New: gcc fails to issue "warning: suggest parentheses around assignment used as truth value" fritz at intrinsity dot com
2010-02-21  0:21 ` [Bug c/32587] " manu at gcc dot gnu dot org
2010-02-21  0:31 ` manu at gcc dot gnu dot org
2010-02-21  0:33 ` manu at gcc dot gnu dot org
2010-02-21  0:33 ` manu at gcc dot gnu dot org

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