Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 302534 - g++-3.4.6 (ssp) stack layout problem involving scopes
Summary: g++-3.4.6 (ssp) stack layout problem involving scopes
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL: http://gcc.gnu.org/bugzilla/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks: 135265
  Show dependency tree
 
Reported: 2010-01-27 21:27 UTC by Thomas Heinz
Modified: 2010-01-27 22:34 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Heinz 2010-01-27 21:27:45 UTC
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.

Note that I reported the bug upstream
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42887,
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42887#c1).

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


Reproducible: Always

Steps to Reproduce:
Comment 1 Gordon Malm (RETIRED) gentoo-dev 2010-01-27 22:12:09 UTC
Closing as WONTFIX. From bug 135265, comment #11:
"GCC 4.3.4 is stable on hardened.  All tracked bugs closed in one form or
another.  GCC 3.4.x is frozen/not being worked on. Closing as WONTFIX."

However, patches are welcome and if anyone is willing to work on the bug it can be re-opened.  But right now there is no-one available to track down problems in gcc-3.4.6.