public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements
@ 2011-11-15  7:59 reichelt at gcc dot gnu.org
  2011-11-15  8:35 ` [Bug c++/51138] " reichelt at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: reichelt at gcc dot gnu.org @ 2011-11-15  7:59 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51138
           Summary: [C++0x] [4.6 Regression] Uninitialized list elements
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: reichelt@gcc.gnu.org


The following code snippet does not work as expected when compiled with
"-std=c++0x" even at "-O0" - it returns 42 instead of 0 (on i686-pc-linux-gnu).

===========================================
#include<list>

int main()
{
  {
    const std::list<int> a(100, 42);
  }

  const std::list<int> b(1);
  return b.back();
}
===========================================

The bug only happens with GCC 4.6.x, trunk seems to be unaffected.


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

* [Bug c++/51138] [C++0x] [4.6 Regression] Uninitialized list elements
  2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
@ 2011-11-15  8:35 ` reichelt at gcc dot gnu.org
  2011-11-15 10:49 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu.org @ 2011-11-15  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Target Milestone|---                         |4.6.3


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

* [Bug c++/51138] [C++0x] [4.6 Regression] Uninitialized list elements
  2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
  2011-11-15  8:35 ` [Bug c++/51138] " reichelt at gcc dot gnu.org
@ 2011-11-15 10:49 ` redi at gcc dot gnu.org
  2011-11-15 11:06 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2011-11-15 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-15
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-15 10:08:44 UTC ---
Confirmed.

With -std=c++0x the constructor calls this with an empty parameter pack:

      template<typename... _Args>
        void
        emplace_back(_Args&&... __args)
        { this->_M_insert(end(), std::forward<_Args>(__args)...); }

which calls allocator::construct with an empty pack:

        _M_get_Node_allocator().construct(__p,
                                          std::forward<_Args>(__args)...);

which does

      template<typename... _Args>
        void
        construct(pointer __p, _Args&&... __args)
        { ::new((void *)__p) _Tp(std::forward<_Args>(__args)...); }


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

* [Bug c++/51138] [C++0x] [4.6 Regression] Uninitialized list elements
  2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
  2011-11-15  8:35 ` [Bug c++/51138] " reichelt at gcc dot gnu.org
  2011-11-15 10:49 ` redi at gcc dot gnu.org
@ 2011-11-15 11:06 ` paolo.carlini at oracle dot com
  2011-11-15 19:10 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-15 11:06 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-15 10:56:16 UTC ---
Maybe we can save time by asking HJ to find the patch which fixed it in
mainline...


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

* [Bug c++/51138] [C++0x] [4.6 Regression] Uninitialized list elements
  2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-11-15 11:06 ` paolo.carlini at oracle dot com
@ 2011-11-15 19:10 ` hjl.tools at gmail dot com
  2011-11-15 19:26 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: hjl.tools at gmail dot com @ 2011-11-15 19:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2011-11-15 18:36:09 UTC ---
It is fixed by revision 175640:

http://gcc.gnu.org/ml/gcc-cvs/2011-06/msg01131.html


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

* [Bug c++/51138] [C++0x] [4.6 Regression] Uninitialized list elements
  2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-11-15 19:10 ` hjl.tools at gmail dot com
@ 2011-11-15 19:26 ` paolo.carlini at oracle dot com
  2011-11-15 21:22 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-15 19:26 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-15 19:08:43 UTC ---
Ah nice, very small, thanks. But I have no idea whether the patch has
dependencies. Jason?


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

* [Bug c++/51138] [C++0x] [4.6 Regression] Uninitialized list elements
  2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2011-11-15 19:26 ` paolo.carlini at oracle dot com
@ 2011-11-15 21:22 ` jason at gcc dot gnu.org
  2012-03-01 15:04 ` jakub at gcc dot gnu.org
  2012-04-25  1:44 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2011-11-15 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-11-15 20:58:12 UTC ---
Backporting that patch doesn't fix the testcase in 4.6.


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

* [Bug c++/51138] [C++0x] [4.6 Regression] Uninitialized list elements
  2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2011-11-15 21:22 ` jason at gcc dot gnu.org
@ 2012-03-01 15:04 ` jakub at gcc dot gnu.org
  2012-04-25  1:44 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-03-01 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.3                       |4.6.4

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-01 14:38:52 UTC ---
GCC 4.6.3 is being released.


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

* [Bug c++/51138] [C++0x] [4.6 Regression] Uninitialized list elements
  2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2012-03-01 15:04 ` jakub at gcc dot gnu.org
@ 2012-04-25  1:44 ` paolo.carlini at oracle dot com
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-25  1:44 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-25 01:44:23 UTC ---
At this point, I don't think the issue will be fixed in 4.6.x.


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

end of thread, other threads:[~2012-04-25  1:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-15  7:59 [Bug c++/51138] New: [C++0x] [4.6 Regression] Uninitialized list elements reichelt at gcc dot gnu.org
2011-11-15  8:35 ` [Bug c++/51138] " reichelt at gcc dot gnu.org
2011-11-15 10:49 ` redi at gcc dot gnu.org
2011-11-15 11:06 ` paolo.carlini at oracle dot com
2011-11-15 19:10 ` hjl.tools at gmail dot com
2011-11-15 19:26 ` paolo.carlini at oracle dot com
2011-11-15 21:22 ` jason at gcc dot gnu.org
2012-03-01 15:04 ` jakub at gcc dot gnu.org
2012-04-25  1:44 ` paolo.carlini at oracle 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).