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 858351 - segfault on compiling partial specialization code
Summary: segfault on compiling partial specialization code
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: gcc
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: 6.6
Assignee: Jakub Jelinek
QA Contact: Miroslav Franc
URL:
Whiteboard:
Depends On:
Blocks: 1023566
TreeView+ depends on / blocked
 
Reported: 2012-09-18 18:22 UTC by takehiro iyatomi
Modified: 2016-02-01 02:27 UTC (History)
6 users (show)

Fixed In Version: gcc-4.4.7-5.el6
Doc Type: Bug Fix
Doc Text:
Previously, GCC could crash on an invalid C++ code involving a partial specialization of a member of a partial specialization. The bug has been fixed and GCC now issues a translation-time error instead of crashing.
Clone Of:
Environment:
Last Closed: 2014-10-14 05:01:19 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
source code to reproduce the problem (2.44 KB, application/octet-stream)
2012-09-18 18:22 UTC, takehiro iyatomi
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 54653 0 None None None Never
Red Hat Product Errata RHBA-2014:1377 0 normal SHIPPED_LIVE gcc bug fix and enhancement update 2014-10-14 01:06:11 UTC

Description takehiro iyatomi 2012-09-18 18:22:16 UTC
Created attachment 614091 [details]
source code to reproduce the problem

Description of problem:
some kind of C++ template partial specialization code causes segfault
(see attachment file bug.cpp)


Version-Release number of selected component (if applicable):
Using built-in specs.
Target: x86_64-redhat-linux
コンフィグオプション: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
スレッドモデル: posix
gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) 


How reproducible:
always


Steps to Reproduce:
1. try to build attachment file bug.cpp with gcc (eg. gcc bug.cpp)
  

Actual results:
[iyatomi@localhost test]$ gcc bug.cpp -lstdc++
bug.cpp: In member function ‘void functional<R(), REFER>::set(FUNCTOR&) [with FUNCTOR = test, R = int, REFER = referer::nop]’:
bug.cpp:43:   instantiated from ‘functional<R(), REFER>::functional(FUNCTOR&) [with FUNCTOR = test, R = int, REFER = referer::nop]’
bug.cpp:75:   instantiated from here
bug.cpp:57: internal compiler error: セグメンテーション違反です


Expected results:
gcc should not cause segfault :P
at least it should print correct compile error message


Additional info:
if I move partial specialization code (functional<R (), REFER>::callee<R (*)(), REFER>) inside of the definition of class functional, this problem seems not to happen.

[iyatomi@localhost test]$ diff bug.cpp bug2.cpp                                              
39a40,47
>       template <typename _R, template <class T> class REF>
>       struct callee<_R (*)(), REF> {
>               typedef _R (*type)();
>               static inline void set(anyptr &p, type f) { p.fn = reinterpret_cast<void (*)()>(f); }
>               static inline type get(anyptr &p) { return reinterpret_cast<type>(p.fn); }
>               static inline R invoke(anyptr &p) { return get(p)(); }
>               static inline void destroy(anyptr &a) {}
>       };
57,64d64
< template <typename R, template <class T> class REFER>
< struct functional<R (), REFER>::callee<R (*)(), REFER> {
<       typedef R (*type)();
<       static inline void set(anyptr &p, type f) { p.fn = reinterpret_cast<void (*)()>(f); }
<       static inline type get(anyptr &p) { return reinterpret_cast<type>(p.fn); }
<       static inline R invoke(anyptr &p) { return get(p)(); }
<       static inline void destroy(anyptr &a) {}
< };
[iyatomi@localhost test]$ gcc bug2.cpp -lstdc++                                              
[iyatomi@localhost test]$ ./a.out 
result:1

Comment 2 Jason Merrill 2012-12-05 19:11:51 UTC
To be equivalent to the in-class version, your out-of-class partial specialization needs another template header.  So instead of

template <typename R, template <class T> class REFER>
struct functional<R (), REFER>::callee<R (*)(), REFER> {

you would have

template <typename R, template <class T> class REFER>
template <typename _R, template <class T> class REF>
struct functional<R (), REFER>::callee<_R (*)(), REF> {

Certainly G++ should give a more useful error message.

Comment 3 RHEL Program Management 2012-12-14 08:32:23 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 10 errata-xmlrpc 2014-10-14 05:01:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1377.html


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