public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jonathan.hogg at stfc dot ac.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/63489] New: stack allocated array pointer corrupted
Date: Wed, 08 Oct 2014 16:01:00 -0000	[thread overview]
Message-ID: <bug-63489-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63489

            Bug ID: 63489
           Summary: stack allocated array pointer corrupted
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jonathan.hogg at stfc dot ac.uk

Created attachment 33667
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33667&action=edit
test case

The attached code, when compiled as
g++ -g -O2 testcase.cxx  -o testcase && ./testcase

and run, produces:
Try 0x7fff1cbe0a00 0x7fff1cbe0a00
Perm exit:  0 1 2 3 4 5 6 7
GO 0x7fff1cbe0a00
Try2 0x100000000 0x100000000 
Segmentation fault


g++ --version:
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


The lines "Try" and "Try2" should be identical, as they refer to the same
stack-allocated array perm[]. Running under valgrind is clean until the last
line of ldlt_test() is encountered (which is clearly a segfault as perm is a
bad pointer).

Compiling without -O2 changes something, and the code crashes differently. I
can supply a larger test case (from which this was created) that shuold produce
meaningful answers if the code works correctly, but it will need to be provided
privately for IP reasons.


             reply	other threads:[~2014-10-08 16:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08 16:01 jonathan.hogg at stfc dot ac.uk [this message]
2014-10-08 17:53 ` [Bug c++/63489] " redi at gcc dot gnu.org
2014-10-08 17:53 ` redi at gcc dot gnu.org
2014-10-09  8:28 ` jonathan.hogg at stfc dot ac.uk
2014-10-09 12:36 ` 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-63489-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).