public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/32182] [4.2 Regression] -fstrict-aliasing optimizations cause constructor not to run for object causing segfault Date: Sat, 02 Jun 2007 11:35:00 -0000 [thread overview] Message-ID: <20070602113526.1842.qmail@sourceware.org> (raw) In-Reply-To: <bug-32182-10468@http.gcc.gnu.org/bugzilla/> ------- Comment #12 from rguenth at gcc dot gnu dot org 2007-06-02 11:35 ------- Confirmed. Actually compiling Wrapper.cxx with -fstrict-aliasing is enough to trigger the failure. In getItem() the difference is <bb 2>: - D.3769 = &_local_result + 4B; - this = (struct BaseClass *) D.3769; - this->d_self = 0B; + D.3821 = &_local_result + 4B; + this = (struct BaseClass *) D.3821; this = (struct NextClass *) &_local_result; iftmp.0 = (int (*__vtbl_ptr_type) (void) *) _ZTT9TestClass[2]; - this->_vptr.NextClass = iftmp.0; _local_result.D.2186._vptr.NextClass = &_ZTV9TestClass[4]; this->_vptr.NextClass = &_ZTV9TestClass[4]; D.2853 = at (cont->d_cont, ind) [return slot optimization]; in addItem() @@ -547,14 +541,12 @@ tmp.D.2186._vptr.NextClass = &_ZTV9TestClass[4]; this.9 = (struct NextClass *) &tmp; this.9->_vptr.NextClass = (int (*__vtbl_ptr_type) (void) *) _ZTT9TestClass[2] ; - D.4100 = &tmp + 4B; - this = (struct BaseClass *) D.4100; - D.4135 = this->d_self; - if (D.4135 != 0B) goto <L21>; else goto <L12>; + D.4160 = &tmp + 4B; + D.4195 = ((struct BaseClass *) D.4160)->d_self; + if (D.4195 != 0B) goto <L21>; else goto <L12>; <L21>:; - deleteRef (D.4135); - this->d_self = 0B; + deleteRef (D.4195); <L12>:; <<<exception object>>> = save_eptr.48; @@ -565,14 +557,12 @@ tmp.D.2186._vptr.NextClass = &_ZTV9TestClass[4]; this.9 = (struct NextClass *) &tmp; this.9->_vptr.NextClass = (int (*__vtbl_ptr_type) (void) *) _ZTT9TestClass[2] ; - D.4155 = &tmp + 4B; - this = (struct BaseClass *) D.4155; - D.4190 = this->d_self; - if (D.4190 != 0B) goto <L39>; else goto <L4>; + D.4215 = &tmp + 4B; + D.4250 = ((struct BaseClass *) D.4215)->d_self; + if (D.4250 != 0B) goto <L39>; else goto <L4>; <L39>:; - deleteRef (D.4190); - this->d_self = 0B; + deleteRef (D.4250); Note that making the inheritance non-virtual and fixing up TestClass::TestClass(TestClass::ior_t*) to initialize NextClass instead of BaseClass fixes the problem as well. So this may be a C++ frontend problem with virtual inheritance or an invalid testcase as well. (What happens if you initialize BaseClass from TestClass, but not NextClass -- if NextClass is default constructed then it will default construct BaseClass as well? C++ language lawyer question.) -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |alias, wrong-code Last reconfirmed|0000-00-00 00:00:00 |2007-06-02 11:35:26 date| | Summary|-fstrict-aliasing |[4.2 Regression] -fstrict- |optimizations cause |aliasing optimizations cause |constructor not to run for |constructor not to run for |object causing segfault |object causing segfault http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32182
next prev parent reply other threads:[~2007-06-02 11:35 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-06-01 20:41 [Bug c++/32182] New: -fstrict-aliasing optimizations cause constructor not to run in " epperly2 at llnl dot gov 2007-06-01 20:44 ` [Bug c++/32182] " epperly2 at llnl dot gov 2007-06-01 20:53 ` [Bug c++/32182] -fstrict-aliasing optimizations cause constructor not to run for object " epperly2 at llnl dot gov 2007-06-01 21:07 ` epperly2 at llnl dot gov 2007-06-01 21:16 ` pinskia at gcc dot gnu dot org 2007-06-01 21:24 ` epperly2 at llnl dot gov 2007-06-01 22:04 ` epperly2 at llnl dot gov 2007-06-01 22:12 ` epperly2 at llnl dot gov 2007-06-01 22:14 ` epperly2 at llnl dot gov 2007-06-01 23:25 ` epperly2 at llnl dot gov 2007-06-01 23:57 ` pinskia at gcc dot gnu dot org 2007-06-02 2:52 ` epperly2 at llnl dot gov 2007-06-02 11:35 ` rguenth at gcc dot gnu dot org [this message] 2007-06-02 11:45 ` [Bug c++/32182] [4.2 Regression] " rguenth at gcc dot gnu dot org 2007-06-04 12:58 ` rguenth at gcc dot gnu dot org 2007-07-04 3:23 ` mmitchel at gcc dot gnu dot org 2007-07-20 3:47 ` mmitchel at gcc dot gnu dot org 2007-10-04 1:30 ` jason at gcc dot gnu dot org 2007-10-09 19:22 ` mmitchel at gcc dot gnu dot org 2008-02-01 16:57 ` jsm28 at gcc dot gnu dot org 2008-05-19 20:27 ` jsm28 at gcc dot gnu dot org 2009-03-30 21:50 ` jsm28 at gcc dot gnu dot 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=20070602113526.1842.qmail@sourceware.org \ --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: linkBe 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).