public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52026] New: [c++0x] g++: Constexpr Variable Appears Uninitialized in Lambda
@ 2012-01-28  4:04 cheesear at gmail dot com
  2012-01-28  4:57 ` [Bug c++/52026] " pinskia at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: cheesear at gmail dot com @ 2012-01-28  4:04 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52026
           Summary: [c++0x] g++: Constexpr Variable Appears Uninitialized
                    in Lambda
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cheesear@gmail.com


Created attachment 26487
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26487
The code sample exhibiting the suspected bug.

Hello everyone,

In the code fragment below, g++ (4.6.1 on Linux Mint 64-bit) complains that x
is uninitialized in the lambda function, and prints out an initialized value
from the stack for the last three lines of the program's output. I'd except all
four lines of the output to be '5', so I suspect that this may be a compiler
bug.

Also, even without the reference-capture in the lambda function, the code still
compiles. Below follows the command used to compile the code, along with one
possible output.

# g++ -Wall -std=c++0x c.cpp
c.cpp: In lambda function:
c.cpp:25:4: warning: ‘x’ is used uninitialized in this function
[-Wuninitialized]

# ./a.out
5
32535
32535
32535


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

end of thread, other threads:[~2014-05-30 18:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-28  4:04 [Bug c++/52026] New: [c++0x] g++: Constexpr Variable Appears Uninitialized in Lambda cheesear at gmail dot com
2012-01-28  4:57 ` [Bug c++/52026] " pinskia at gcc dot gnu.org
2012-08-08  8:58 ` slipstreamdrive at hotmail dot com
2012-08-08  9:01 ` slipstreamdrive at hotmail dot com
2012-08-17 15:35 ` jpalecek at web dot de
2012-08-19 14:05 ` jpalecek at web dot de
2012-08-19 14:14 ` jpalecek at web dot de
2012-08-19 14:38 ` paolo.carlini at oracle dot com
2012-08-19 15:38 ` jpalecek at web dot de
2012-08-20  9:07 ` paolo.carlini at oracle dot com
2013-01-29 13:31 ` [Bug c++/52026] [c++0x] " matt at godbolt dot org
2013-02-14 23:54 ` [Bug c++/52026] [4.6/4.7/4.8 Regression] " paolo.carlini at oracle dot com
2013-02-15 16:17 ` jason at gcc dot gnu.org
2013-02-15 18:33 ` jason at gcc dot gnu.org
2013-02-15 18:39 ` jason at gcc dot gnu.org
2014-05-30 18:58 ` jason 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).