public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cheesear at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/52026] New: [c++0x] g++: Constexpr Variable Appears Uninitialized in Lambda
Date: Sat, 28 Jan 2012 04:04:00 -0000	[thread overview]
Message-ID: <bug-52026-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2012-01-28  3:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-28  4:04 cheesear at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52026-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).