RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 985895 - G++ miscompiles callable construct
Summary: G++ miscompiles callable construct
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gcc
Version: 6.4
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks: 994246 1056252
TreeView+ depends on / blocked
 
Reported: 2013-07-18 13:02 UTC by Gregor Jasny
Modified: 2018-12-05 16:10 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-05-06 11:01:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Test case (39.38 KB, application/x-gzip)
2013-07-18 13:02 UTC, Gregor Jasny
no flags Details
Minimized test case (398 bytes, text/plain)
2014-04-24 18:59 UTC, Petr Machata
no flags Details

Description Gregor Jasny 2013-07-18 13:02:22 UTC
Created attachment 775307 [details]
Test case

Description of problem:
Attached you'll find a testcase (.ii file included) that is miscompiled by GCC with O2 optimization level. Clang 3.3 and GCC 4.8 (on Debian) produces a proper binary.

If I add printf logging to all ctors and dtors of all classes that are involved, the program works too.

The binary is valgrind clean.

Version-Release number of selected component (if applicable):
RHEL 6.4 x86_64
boost-devel-1.41.0-17.el6_4.x86_64
gcc-c++-4.4.7-3.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. make
2. ./testcase

Actual results:
"pure virtual method called"

(gdb) bt
#0  0x00000035ad2328a5 in raise () from /lib64/libc.so.6
#1  0x00000035ad234085 in abort () from /lib64/libc.so.6
#2  0x0000003f77ebea5d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib64/libstdc++.so.6
#3  0x0000003f77ebcbe6 in ?? () from /usr/lib64/libstdc++.so.6
#4  0x0000003f77ebcc13 in std::terminate() () from /usr/lib64/libstdc++.so.6
#5  0x0000003f77ebd53f in __cxa_pure_virtual () from /usr/lib64/libstdc++.so.6
#6  0x00000000004009a9 in PeriodicTimer::startInternal(int, PeriodicTimer::ITimerCallback&) ()
#7  0x0000000000400a3c in PeriodicTimerTests::shouldBeAbleToRestartTimer() ()
#8  0x0000000000400aa5 in main ()

Expected results:
Should work without problems.

Thanks,
Gregor

Comment 10 Petr Machata 2014-04-24 18:59:05 UTC
Created attachment 889408 [details]
Minimized test case

# g++ -O2 /meh.cc && ./a.out
pure virtual method called
terminate called without an active exception
Aborted
# g++ --version
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 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.

- vs. -

$ g++ /var/lib/mock/epel-6-x86_64/root/meh.cc && ./a.out
$ g++ --version
g++ (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)
Copyright (C) 2011 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.

Comment 11 Petr Machata 2014-04-24 19:01:00 UTC
Oops, forgot about -O2 in the latter run.  It still passes even with that.

Comment 17 Matt Newsome 2014-04-29 14:28:18 UTC
In reviewing this case for Red Hat platform engineering, our conclusion is that this is an issue in the gcc-4.4 shipped in RHEL 6, but fixing it via a backported patch would risk reducing overall toolchain stability.

Fortunately we're proposing two potential workarounds:

 - Red Hat Developer Toolset v2.1 provides gcc-4.8 for RHEL 6 and in our testing does not exhibit this issue
 - Use of -fno-tree-sink during compilation is expected to resolve the issue you are seeing

We recommend using either of these workarounds. Please let us know if these resolve your issue and we'll close out this bug. Thanks.


Note You need to log in before you can comment on or make changes to this bug.