[Bug c++/55131] New: Segmentation fault happened after upgraded g++ from 3.4.6 to 4.7.0
mawenqi108 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Oct 30 02:17:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55131
Bug #: 55131
Summary: Segmentation fault happened after upgraded g++ from
3.4.6 to 4.7.0
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: blocker
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mawenqi108@gmail.com
Created attachment 28570
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28570
The source file
Recently I have upgraded the build environment from RHEL 4.7 (32bit) with g++
3.4.6 to CentOS 6.3 (32bit) with g++ 4.7.0. While an inline assembly function,
which implements the atomic comparison and exchange function, could not work
anymore.The attachment is the source file for your reference.
On the old RHEL 4.7 environment:
# g++ -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)
# g++ -Wall -Wextra -g -o test test.cpp
test.cpp:37: warning: unused parameter 'argc'
test.cpp:37: warning: unused parameter 'argv'
# ./test
1 val = 0, oldv = 0, newv = 20
2 val = 20, oldv = 0, newv = 20
3 val = 20, oldv = 20, newv = 20
However, on the new CentOS 6.3 environment:
# g++47 -v
Using built-in specs.
COLLECT_GCC=g++47
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux4.7.0/4.7.0/lto-wrapper
Target: i686-redhat-linux4.7.0
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-bootstrap --enable-shared
--enable-threads=posix --enable-checking=release --disable-build-with-cxx
--with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++
--disable-profiling --enable-ld --disable-libgcj --disable-java --disable-gcj
--disable-libgcj-multifile --disable-plugin --enable-linker-build-id
--with-tune=generic --with-arch=i686 --build=i686-redhat-linux4.7.0
Thread model: posix
gcc version 4.7.0 20120507 (Red Hat 4.7.0-3) (GCC)
# g++47 -Wall -Wextra -g -fno-strict-aliasing -fwrapv -o test test.cpp
test.cpp:36:5: warning: unused parameter ‘argc’ [-Wunused-parameter]
test.cpp:36:5: warning: unused parameter ‘argv’ [-Wunused-parameter]
# ./test
1 val = 0, oldv = 0, newv = 20
Segmentation fault (core dumped)
GDB print following info:
(gdb) r
Starting program: /home/share/tmp/test
1 val = 0, oldv = 0, newv = 20
Program received signal SIGSEGV, Segmentation fault.
0x08048831 in MyAtomic_CAS64 (tgt=0xbffff610, old=0xbffff608, rep=20) at
test.cpp:31
31 : "memory", "edx", "esi", "edi", "cc");
Thanks!
More information about the Gcc-bugs
mailing list