This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/59970] Bogus warnings at low optimization levels


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59970

Mike Crowe <mac at mcrowe dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mac at mcrowe dot com

--- Comment #3 from Mike Crowe <mac at mcrowe dot com> ---
Created attachment 35384
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35384&action=edit
Preprocessed source for boost::lexical_cast case

I can reproduce the same problem with Debian Jessie's gcc 4.9.2 and a
self-compiled gcc 4.9.1 when compiling:

 #include <boost/lexical_cast.hpp>

 int wibble()
 {
     return boost::lexical_cast<int>("1");
 }

Preprocessed source attached (compressed to avoid file size limit.)

 $ g++ -Wall -Werror -Og -save-temps test.cpp
 test.cpp: In function âint wibble()â:
 test.cpp:5:40: error: âresultâ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
      return boost::lexical_cast<int>("1");
                                        ^
 cc1plus: all warnings being treated as errors

Oddly the warning is not reported when the function is named "main"!

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]