public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51457] New: Add warning about impossible boolean comparisons
@ 2011-12-07 20:27 lloyd at randombit dot net
  2011-12-14 23:11 ` [Bug c++/51457] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: lloyd at randombit dot net @ 2011-12-07 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51457
           Summary: Add warning about impossible boolean comparisons
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: lloyd@randombit.net


Neither GCC 4.6.0 (release) and 4.7 svn (r181390) warn about the impossible
comparison in

bool f(bool b)
   {
   return (b == 'a');
   }

The optimizer figures out it is always false and will optimize it to

        xorl    %eax, %eax
        ret

>From the description in the manual I would have expected -Wtype-limits to
detect this case.


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

* [Bug c++/51457] Add warning about impossible boolean comparisons
  2011-12-07 20:27 [Bug c++/51457] New: Add warning about impossible boolean comparisons lloyd at randombit dot net
@ 2011-12-14 23:11 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-14 23:11 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-14 23:09:55 UTC ---
Dup of bug 44077

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


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

end of thread, other threads:[~2011-12-14 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07 20:27 [Bug c++/51457] New: Add warning about impossible boolean comparisons lloyd at randombit dot net
2011-12-14 23:11 ` [Bug c++/51457] " pinskia at gcc dot gnu.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).