This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/8404: arguments/stack corrupted when passing non-byte alignedstruct with attribute packed
- From: Frédéric L. W. Meunier <0 at pervalidus dot net>
- To: gcc-bugs at gcc dot gnu dot org
- Cc: Bruce Allen <ballen at uwm dot edu>
- Date: Sat, 2 Nov 2002 19:29:28 -0300 (BRT)
- Subject: Re: c/8404: arguments/stack corrupted when passing non-byte alignedstruct with attribute packed
I'd like to add some more information to my gcc/GNATS bug
report #8404 -
http://gcc.gnu.org/ml/gcc-bugs/2002-10/msg01238.html
Here's what I did in mid August:
1- Install a distribution (was Slackware -current).
2- Compile kernel 2.4.19.
3- Bootstrap GCC 2.95.4 CVS (core 2.95.3 + rdiff from CVS) with
egcs 1.1.2.
--prefix=/usr --enable-threads --enable-languages=c++
--disable-nls
make BOOT_CFLAGS=-O2 CFLAGS=-O2 LIBCFLAGS=-O2 CXXFLAGS=-O2
LIBCXXFLAGS='-O2 -fno-implcit-templates' LDFLAGS=-s bootstrap
4- Compile binutils 2.13.90.0.4 with the new compiler.
--prefix=/usr --enable-shared --disable-nls
make CFLAGS=-O2 LDFLAGS=-s
5- Compile glibc 2.2.5 (system installed was also 2.2.5).
--prefix=/usr --without-cvs
--with-headers=/usr/local/src/linux/include --disable-profile
--enable-add-ons=linuxthreads --enable-kernel=2.4.5
make; make check
6- Finally bootstrap GCC 3.2.
--prefix=/usr --libdir=/usr/lib --with-slibdir=/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--enable-threads --enable-__cxa_atexit --enable-languages=c++
--disable-nls
make BOOT_CFLAGS=-O2 CFLAGS=-O2 CXXFLAGS=-O2 LIBCFLAGS=-O2
LIBCXXFLAGS='-O2 -fno-implcit-templates' LDFLAGS=-s bootstrap
No more changes with such tools.
My 3.2 was compiled with what configure found, which is
i686-pc-linux-gnu. Then it defaults to -march=i686 -mcpu=i686.
Using bug.c or smartmontools by Bruce Allen (or the
old smartsuite):
I added -march=i386 -mcpu=i386 after -O2 and yes, it produced
correct code.
Also correct:
-march=i486 -mcpu=i486
-march=i586 -mcpu=i586
-march=k6 -mcpu=k6
-march=i686 -mcpu=i386
The following produce incorrect code:
-march=i686 -mcpu=i686
-march=athlon -mcpu=athlon
-march=i386 -mcpu=i686
They produce correct code with -Os.
They produce incorrect code with -O3, -O2, -O1, -O0, -O, and no
-O.
--
0@pervalidus.{net, {dyndns.}org}