public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mawenqi108 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/55131] New: Segmentation fault happened after upgraded g++ from 3.4.6 to 4.7.0
Date: Tue, 30 Oct 2012 02:17:00 -0000	[thread overview]
Message-ID: <bug-55131-4@http.gcc.gnu.org/bugzilla/> (raw)


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!


             reply	other threads:[~2012-10-30  2:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30  2:17 mawenqi108 at gmail dot com [this message]
2012-10-30  2:21 ` [Bug c++/55131] Segmentation fault happened in resulting code (inline-asm) " pinskia at gcc dot gnu.org
2012-10-30  2:28 ` [Bug inline-asm/55131] " pinskia at gcc dot gnu.org
2012-10-30  6:22 ` [Bug c++/55131] " mawenqi108 at gmail dot com
2012-10-30  6:25 ` mawenqi108 at gmail dot com
2012-10-30  9:28 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-55131-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).