public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33925]  New: gcc -Waddress lost some useful warnings
@ 2007-10-27 17:17 mec at google dot com
  2008-01-31  2:46 ` [Bug c++/33925] " manu at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: mec at google dot com @ 2007-10-27 17:17 UTC (permalink / raw)
  To: gcc-bugs

gcc -Waddress got a little bit worse between gcc 4.0.4 and gcc 4.1.2.  It would
be useful to get this warning, especially for C++ inline methods.

mec@hollerith:~/exp-address$ cat z2.cc
extern bool Alpha();
inline bool Beta(bool b) { return b; }
class MyClass { public: static bool MyMethod(bool b) { return b; } };

bool Gamma() {
 if (Alpha) {
   if (Beta) {
     if (MyClass::MyMethod) {
       return true;
     }
   }
 }
 return false;
}

mec@hollerith:~/exp-address$ /home/mec/gcc-4.0.4/install/bin/g++ -Wall -O2 -S
z2.cc
z2.cc: In function 'bool Gamma()':
z2.cc:6: warning: the address of 'bool Alpha()', will always evaluate as 'true'
z2.cc:7: warning: the address of 'bool Beta(bool)', will always evaluate as
'true'
z2.cc:8: warning: the address of 'static bool MyClass::MyMethod(bool)', will
always evaluate as 'true'

mec@hollerith:~/exp-address$ /home/mec/gcc-4.1.2/install/bin/g++ -Wall -O2 -S
z2.cc
z2.cc: In function 'bool Gamma()':
z2.cc:6: warning: the address of 'bool Alpha()', will always evaluate as 'true'

mec@hollerith:~/exp-address$ /home/mec/gcc-4.2.2/install/bin/g++ -Wall -O2 -S
z2.cc
z2.cc: In function 'bool Gamma()':
z2.cc:6: warning: the address of 'bool Alpha()' will always evaluate as 'true'

mec@hollerith:~/exp-address$ /home/mec/gcc-4.3-20071019/install/bin/g++ -Wall
-O2 -S z2.cc
z2.cc: In function 'bool Gamma()':
z2.cc:6: warning: the address of 'bool Alpha()' will always evaluate as 'true'

mec@hollerith:~/exp-address$


-- 
           Summary: gcc -Waddress lost some useful warnings
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mec at google dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2022-01-26 17:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-33925-4@http.gcc.gnu.org/bugzilla/>
2012-04-18 16:34 ` [Bug c++/33925] gcc -Waddress lost some useful warnings manu at gcc dot gnu.org
2012-04-18 17:04 ` redi at gcc dot gnu.org
2012-04-18 17:07 ` redi at gcc dot gnu.org
2012-04-20 12:59 ` manu at gcc dot gnu.org
2021-10-01 18:09 ` msebor at gcc dot gnu.org
2021-10-04 19:20 ` [Bug c++/33925] [10/11/12 Regression] " msebor at gcc dot gnu.org
2021-11-16 12:58 ` rguenth at gcc dot gnu.org
2021-11-19 16:48 ` cvs-commit at gcc dot gnu.org
2021-11-19 16:49 ` [Bug c++/33925] [10/11 " msebor at gcc dot gnu.org
2022-01-26 17:46 ` msebor at gcc dot gnu.org
2007-10-27 17:17 [Bug c++/33925] New: " mec at google dot com
2008-01-31  2:46 ` [Bug c++/33925] " manu at gcc dot gnu dot org
2009-07-31 15:13 ` manu at gcc dot gnu dot org
2009-07-31 16:04 ` mec at google dot com

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