public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64527] New: Constructor for empty struct not called in some situations
@ 2015-01-07 19:21 gcc at swtaarrs dot com
  2015-01-07 21:20 ` [Bug c++/64527] " gcc at swtaarrs dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gcc at swtaarrs dot com @ 2015-01-07 19:21 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5062 bytes --]

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

            Bug ID: 64527
           Summary: Constructor for empty struct not called in some
                    situations
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at swtaarrs dot com

Created attachment 34396
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34396&action=edit
c++ code exposing the bug

Build ctor.cpp with the following command:

> g++ -std=c++11 -Os -S -o ctor.S ctor.cpp

The optimization level doesn't appear to affect the presence of the bug, I just
used -Os to keep the output more compact.

Expected results: The m() function in ctor.S should contain a call to A::A().

Actual results: m() does nothing but zero out accessor::x. I've found at least
three ways to perturb the bug out of existence which are documented in comments
in the file.

The bug is also present in gcc 4.8.1 (I haven't tried anything older).

Compiling with -Wextra reports "warning: missing initializer for member
‘accessor::a’ [-Wmissing-field-initializers]" but I believe this shouldn't
affect the ouput.


gcc build info:

Target: x86_64-unknown-linux-gnu
Configured with: ./configure --prefix=/home/matthew/gcc-4.9.0-prefix
Thread model: posix
gcc version 4.9.0 (GCC)
>From gcc-bugs-return-472409-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jan 07 19:39:40 2015
Return-Path: <gcc-bugs-return-472409-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23856 invoked by alias); 7 Jan 2015 19:39:39 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 23798 invoked by uid 48); 7 Jan 2015 19:39:33 -0000
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/64528] New: [5 Regression] ICE: in process_constraint, at tree-ssa-structalias.c:3002 with -O -fno-tree-ccp -fno-tree-dce
Date: Wed, 07 Jan 2015 19:39:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: zsojka at seznam dot cz
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-64528-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg00403.txt.bz2
Content-length: 1711

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd528

            Bug ID: 64528
           Summary: [5 Regression] ICE: in process_constraint, at
                    tree-ssa-structalias.c:3002 with -O -fno-tree-ccp
                    -fno-tree-dce
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz

Created attachment 34397
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id4397&actioníit
reduced testcase (from gfortran.dg/value_test.f90)

Compiler output:
$ gcc -O -fno-tree-ccp -fno-tree-dce testcase.f90
testcase.f90:11:0:

 end program valueTests
 ^
internal compiler error: in process_constraint, at tree-ssa-structalias.c:3002
0xe7907d process_constraint
        /mnt/svn/gcc-trunk/gcc/tree-ssa-structalias.c:3002
0xe793b3 process_all_all_constraints
        /mnt/svn/gcc-trunk/gcc/tree-ssa-structalias.c:3581
0xe84cd3 find_func_aliases
        /mnt/svn/gcc-trunk/gcc/tree-ssa-structalias.c:4748
0xe87c26 compute_points_to_sets
        /mnt/svn/gcc-trunk/gcc/tree-ssa-structalias.c:6825
0xe87c26 compute_may_aliases()
        /mnt/svn/gcc-trunk/gcc/tree-ssa-structalias.c:7161
0xbbd8ec execute_function_todo
        /mnt/svn/gcc-trunk/gcc/passes.c:1912
0xbbe563 execute_todo
        /mnt/svn/gcc-trunk/gcc/passes.c:1997
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r219277 - ICE
r218446 - ICE
r212099 - ICE
4_9 r219040 - OK


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/64527] Constructor for empty struct not called in some situations
  2015-01-07 19:21 [Bug c++/64527] New: Constructor for empty struct not called in some situations gcc at swtaarrs dot com
@ 2015-01-07 21:20 ` gcc at swtaarrs dot com
  2015-04-15 13:15 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: gcc at swtaarrs dot com @ 2015-01-07 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Brett Simmers <gcc at swtaarrs dot com> ---
Sorry, the attachment should be named ctor.cpp. I didn't realize it was a
filename and not a text description.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/64527] Constructor for empty struct not called in some situations
  2015-01-07 19:21 [Bug c++/64527] New: Constructor for empty struct not called in some situations gcc at swtaarrs dot com
  2015-01-07 21:20 ` [Bug c++/64527] " gcc at swtaarrs dot com
@ 2015-04-15 13:15 ` ppalka at gcc dot gnu.org
  2015-04-17 12:15 ` ppalka at gcc dot gnu.org
  2015-04-17 12:50 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-04-15 13:15 UTC (permalink / raw)
  To: gcc-bugs

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

ppalka at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

--- Comment #2 from ppalka at gcc dot gnu.org ---
I will post a patch for this later today.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/64527] Constructor for empty struct not called in some situations
  2015-01-07 19:21 [Bug c++/64527] New: Constructor for empty struct not called in some situations gcc at swtaarrs dot com
  2015-01-07 21:20 ` [Bug c++/64527] " gcc at swtaarrs dot com
  2015-04-15 13:15 ` ppalka at gcc dot gnu.org
@ 2015-04-17 12:15 ` ppalka at gcc dot gnu.org
  2015-04-17 12:50 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-04-17 12:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from ppalka at gcc dot gnu.org ---
Author: ppalka
Date: Fri Apr 17 12:14:24 2015
New Revision: 222176

URL: https://gcc.gnu.org/viewcvs?rev=222176&root=gcc&view=rev
Log:
Fix PR c++/64527

gcc/
    PR c++/64527
    * gimplify.c (gimplify_init_constructor): Always emit a
    side-effecting constructor.

gcc/testsuite/
    PR c++/64527
    * g++.dg/init/pr64527.C: New test.



Added:
    trunk/gcc/testsuite/g++.dg/init/pr64527.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimplify.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/64527] Constructor for empty struct not called in some situations
  2015-01-07 19:21 [Bug c++/64527] New: Constructor for empty struct not called in some situations gcc at swtaarrs dot com
                   ` (2 preceding siblings ...)
  2015-04-17 12:15 ` ppalka at gcc dot gnu.org
@ 2015-04-17 12:50 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2015-04-17 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

ppalka at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from ppalka at gcc dot gnu.org ---
Fixed. Thanks for the comprehensive test case.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-17 12:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 19:21 [Bug c++/64527] New: Constructor for empty struct not called in some situations gcc at swtaarrs dot com
2015-01-07 21:20 ` [Bug c++/64527] " gcc at swtaarrs dot com
2015-04-15 13:15 ` ppalka at gcc dot gnu.org
2015-04-17 12:15 ` ppalka at gcc dot gnu.org
2015-04-17 12:50 ` ppalka at gcc dot gnu.org

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).