public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases
@ 2012-04-21 12:10 ratnikov.ev at ya dot ru
  2012-04-21 12:24 ` [Bug c++/53059] " ratnikov.ev at ya dot ru
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: ratnikov.ev at ya dot ru @ 2012-04-21 12:10 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53059
           Summary: sizeof(std::list)=12 was 8 in previous releases
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ratnikov.ev@ya.ru


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
@ 2012-04-21 12:24 ` ratnikov.ev at ya dot ru
  2012-04-21 18:08 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ratnikov.ev at ya dot ru @ 2012-04-21 12:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from ratnikov.ev at ya dot ru 2012-04-21 12:23:36 UTC ---
g++ -v       
Reading specs from /usr/lib/gcc/i486-slackware-linux/4.7.0/specs
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-slackware-linux/4.7.0/lto-wrapper
Target: i486-slackware-linux
Configured with: ../gcc-4.7.0/configure --prefix=/usr --libdir=/usr/lib
--mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap
--enable-languages=ada,c,c++,fortran,go,java,lto,objc --enable-threads=posix
--enable-checking=release --enable-objc-gc --with-system-zlib
--with-python-dir=/lib/python2.6/site-packages --disable-libunwind-exceptions
--enable-__cxa_atexit --enable-libssp --enable-lto --with-gnu-ld --verbose
--enable-java-home --with-java-home=/usr/lib/jvm/jre
--with-jvm-root-dir=/usr/lib/jvm --with-jvm-jar-dir=/usr/lib/jvm/jvm-exports
--with-arch-directory=i386
--with-antlr-jar=/root/slackware-current/source/d/gcc/antlr-runtime-3.4.jar
--enable-java-awt=gtk --disable-gtktest --with-arch=i486
--target=i486-slackware-linux --build=i486-slackware-linux
--host=i486-slackware-linux
Thread model: posix
gcc version 4.7.0 (GCC) 

cat sz.cc
#include <list>
#include <iostream>
int main(int ac, char* av[])
{
    constexpr size_t list_sz(sizeof(std::list<int>));
    static_assert(list_sz == 8, "size of list changed");
    return 0;
}

g++ -std=c++0x -save-temps sz.cc -o sz
sz.cc: In function ‘int main(int, char**)’:
sz.cc:7:5: error: static assertion failed: size of list changed

no *.i files were generated


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
  2012-04-21 12:24 ` [Bug c++/53059] " ratnikov.ev at ya dot ru
@ 2012-04-21 18:08 ` redi at gcc dot gnu.org
  2012-04-21 18:09 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-21 18:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-21 18:05:42 UTC ---
Why do you think this is a bug?

The C++ 2011 standard requires that std::list::size() is O(1) so a new member
variable is needed to store the container's size.


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
  2012-04-21 12:24 ` [Bug c++/53059] " ratnikov.ev at ya dot ru
  2012-04-21 18:08 ` redi at gcc dot gnu.org
@ 2012-04-21 18:09 ` redi at gcc dot gnu.org
  2012-04-21 22:19 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-21 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-21 18:06:31 UTC ---
N.B. the size is still 8 with -std=c++98


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
                   ` (2 preceding siblings ...)
  2012-04-21 18:09 ` redi at gcc dot gnu.org
@ 2012-04-21 22:19 ` paolo.carlini at oracle dot com
  2012-04-22  3:27 ` ratnikov.ev at ya dot ru
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-21 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-21 22:18:25 UTC ---
.


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
                   ` (3 preceding siblings ...)
  2012-04-21 22:19 ` paolo.carlini at oracle dot com
@ 2012-04-22  3:27 ` ratnikov.ev at ya dot ru
  2012-04-22  8:47 ` ratnikov.ev at ya dot ru
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ratnikov.ev at ya dot ru @ 2012-04-22  3:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from ratnikov.ev at ya dot ru 2012-04-22 03:26:43 UTC ---
Anyway there will be no backward compability.
I mean when I use a library compiled with gcc-4.7.0 + 0x with other code
compiled with pervious gcc versions (and vice versa).
It is real problem to use 3rd parties (gcc-4.7 + 0x) with my project (gcc-4.5).


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
                   ` (4 preceding siblings ...)
  2012-04-22  3:27 ` ratnikov.ev at ya dot ru
@ 2012-04-22  8:47 ` ratnikov.ev at ya dot ru
  2012-04-22 11:38 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ratnikov.ev at ya dot ru @ 2012-04-22  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Evgeny Ratnikov <ratnikov.ev at ya dot ru> 2012-04-22 08:47:07 UTC ---
(In reply to comment #2)
> Why do you think this is a bug?
> 
> The C++ 2011 standard requires that std::list::size() is O(1) so a new member
> variable is needed to store the container's size.

To be clear.
It is not a real problem that the size of std::list was changed. The real
problem is that after such change my application (-std=98) linked with
libraries (-std=0x) causes corrupted stack.
May be I was too precise naming a bug.
It would be nice to hear your opinion about my situation.


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
                   ` (5 preceding siblings ...)
  2012-04-22  8:47 ` ratnikov.ev at ya dot ru
@ 2012-04-22 11:38 ` redi at gcc dot gnu.org
  2012-04-22 19:11 ` ratnikov.ev at ya dot ru
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-04-22 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-22 11:38:36 UTC ---
(In reply to comment #6)
> problem is that after such change my application (-std=98) linked with
> libraries (-std=0x) causes corrupted stack.

You can't do that. It won't work.


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
                   ` (6 preceding siblings ...)
  2012-04-22 11:38 ` redi at gcc dot gnu.org
@ 2012-04-22 19:11 ` ratnikov.ev at ya dot ru
  2012-04-22 19:19 ` paolo.carlini at oracle dot com
  2012-04-23  2:47 ` ratnikov.ev at ya dot ru
  9 siblings, 0 replies; 11+ messages in thread
From: ratnikov.ev at ya dot ru @ 2012-04-22 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Evgeny Ratnikov <ratnikov.ev at ya dot ru> 2012-04-22 19:11:22 UTC ---
(In reply to comment #7)
> (In reply to comment #6)
> > problem is that after such change my application (-std=98) linked with
> > libraries (-std=0x) causes corrupted stack.
> 
> You can't do that. It won't work.

And what about the reverse situation?
Old libraries, compiled with -std=98 and new code compiled with -std=0x.
It is clear that there would be run-time problems.
By the way there is nothing about it in 4.7.0-changes.


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
                   ` (7 preceding siblings ...)
  2012-04-22 19:11 ` ratnikov.ev at ya dot ru
@ 2012-04-22 19:19 ` paolo.carlini at oracle dot com
  2012-04-23  2:47 ` ratnikov.ev at ya dot ru
  9 siblings, 0 replies; 11+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-04-22 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-04-22 19:18:13 UTC ---
That last situation is really totally unsupported and never was. By the way, I
don't know if you noticed already, but it doesn't work for many, many, reasons
outside sizes of containers. It's totally broken everywhere. The linker should
also warn about that, I think we have a PR, it's a much more general issue,
warn when linking together stuff built passing ABI-incompatible switches.


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

* [Bug c++/53059] sizeof(std::list)=12 was 8 in previous releases
  2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
                   ` (8 preceding siblings ...)
  2012-04-22 19:19 ` paolo.carlini at oracle dot com
@ 2012-04-23  2:47 ` ratnikov.ev at ya dot ru
  9 siblings, 0 replies; 11+ messages in thread
From: ratnikov.ev at ya dot ru @ 2012-04-23  2:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Evgeny Ratnikov <ratnikov.ev at ya dot ru> 2012-04-23 02:47:37 UTC ---
Now it's clear. Thanks for replies.
.


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

end of thread, other threads:[~2012-04-23  2:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-21 12:10 [Bug c++/53059] New: sizeof(std::list)=12 was 8 in previous releases ratnikov.ev at ya dot ru
2012-04-21 12:24 ` [Bug c++/53059] " ratnikov.ev at ya dot ru
2012-04-21 18:08 ` redi at gcc dot gnu.org
2012-04-21 18:09 ` redi at gcc dot gnu.org
2012-04-21 22:19 ` paolo.carlini at oracle dot com
2012-04-22  3:27 ` ratnikov.ev at ya dot ru
2012-04-22  8:47 ` ratnikov.ev at ya dot ru
2012-04-22 11:38 ` redi at gcc dot gnu.org
2012-04-22 19:11 ` ratnikov.ev at ya dot ru
2012-04-22 19:19 ` paolo.carlini at oracle dot com
2012-04-23  2:47 ` ratnikov.ev at ya dot ru

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