public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42887]  New: g++-3.4.6 (ssp) stack layout problem involving scopes
@ 2010-01-27 21:14 thomasheinz at gmx dot net
  2010-01-27 21:17 ` [Bug c++/42887] " pinskia at gcc dot gnu dot org
  2010-01-27 21:29 ` thomasheinz at gmx dot net
  0 siblings, 2 replies; 3+ messages in thread
From: thomasheinz at gmx dot net @ 2010-01-27 21:14 UTC (permalink / raw)
  To: gcc-bugs

Consider the following sample:

#include <cstdio>

struct C
{
        int a,b,c,d,e;
        C()
        {
                printf("&e = %p\n", &e);
                e = 12345;
        }
};

int main()
{
        unsigned long long a[] = {1, 2};
        printf("a = %p, a[0] = %lld\n", a, a[0]);
        {
                C s;
        }
        printf("a = %p, a[0] = %lld\n", a, a[0]);
        unsigned long long b[] = {3, 4};
        return 0;
}

Compiling with `g++ sample.cpp` yields the following output:
a = 0xbfdb7920, a[0] = 1
&e = 0xbfdb7920
a = 0xbfdb7920, a[0] = 12345

whereas compiling with `g++ -fno-stack-protector sample.cpp` yields:
a = 0xbfc1cf90, a[0] = 1
&e = 0xbfc1cf80
a = 0xbfc1cf90, a[0] = 1

I don't have time to go into more detail but the sample should be small
enough to figure the problem out.


# gcc -v
Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/specs
Configured with:
/var/tmp/portage/sys-devel/gcc-3.4.6-r2/work/gcc-3.4.6/configure --prefix=/usr
--bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.6
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.6/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/include/g++-v3
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --enable-secureplt --disable-multilib --disable-libgcj
--with-arch=i686 --enable-languages=c,c++,treelang,f77 --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.6 (Gentoo Hardened 3.4.6-r2 p1.6, ssp-3.4.6-1.0, pie-8.7.10)


-- 
           Summary: g++-3.4.6 (ssp) stack layout problem involving scopes
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: thomasheinz at gmx dot net
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug c++/42887] g++-3.4.6 (ssp) stack layout problem involving scopes
  2010-01-27 21:14 [Bug c++/42887] New: g++-3.4.6 (ssp) stack layout problem involving scopes thomasheinz at gmx dot net
@ 2010-01-27 21:17 ` pinskia at gcc dot gnu dot org
  2010-01-27 21:29 ` thomasheinz at gmx dot net
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-01-27 21:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-01-27 21:17 -------
>Gentoo Hardened

You should report this bug to gentoo.  It is a heavily modified version of GCC
that we cannot support.  Plus 3.4.6 is no longer supported so please try 4.3.x
or 4.4.x which has ssp support already in there and is supported.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|wrong-code                  |
         Resolution|                            |INVALID


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


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

* [Bug c++/42887] g++-3.4.6 (ssp) stack layout problem involving scopes
  2010-01-27 21:14 [Bug c++/42887] New: g++-3.4.6 (ssp) stack layout problem involving scopes thomasheinz at gmx dot net
  2010-01-27 21:17 ` [Bug c++/42887] " pinskia at gcc dot gnu dot org
@ 2010-01-27 21:29 ` thomasheinz at gmx dot net
  1 sibling, 0 replies; 3+ messages in thread
From: thomasheinz at gmx dot net @ 2010-01-27 21:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from thomasheinz at gmx dot net  2010-01-27 21:29 -------
Thanks for your quick reply. I reported the bug to gentoo:
https://bugs.gentoo.org/show_bug.cgi?id=302534


-- 


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


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

end of thread, other threads:[~2010-01-27 21:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-27 21:14 [Bug c++/42887] New: g++-3.4.6 (ssp) stack layout problem involving scopes thomasheinz at gmx dot net
2010-01-27 21:17 ` [Bug c++/42887] " pinskia at gcc dot gnu dot org
2010-01-27 21:29 ` thomasheinz at gmx dot net

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