Bug 657606

Summary: g++ 4.5.1 internal compiler error: Segmentation fault compiling libdecnumber
Product: [Fedora] Fedora Reporter: triumphs3
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-09 11:28:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description triumphs3 2010-11-26 19:28:38 UTC
Description of problem:

Internal compiler error while compiling libdecnumber (decimal floating point library).

  
Version-Release number of selected component (if applicable):
gcc-c++-4.5.1-4 and 4.6.x on F14

How to reproduce:
Test-case:
//Begin t.C
#include <iostream>
namespace std {
  namespace decimal {
     template <class _Fmt> struct _FmtTraits;
     class decimal32;
     template <class _T> struct _Is_decimal_fp_aux {  static const bool value = false; };
     template <> struct _Is_decimal_fp_aux<decimal32> { static const bool value = true; };
     template <class _Tr> class _DecBase { };
     class decimal32 : public _DecBase<_FmtTraits<decimal32> > { };
  }
}
//end t.C


Steps to Reproduce:
1. g++ -c t.C
  
Actual results:
t.C:8:83: internal compiler error: Segmentation fault

Please submit a full bug report,with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.  

Expected results:
Clean compile.

Additional info:
If I remove <iostream> it compiles. If I remove the nested namespace decimal it compiles.

Comment 1 Jakub Jelinek 2010-12-09 11:28:10 UTC
This is invalid testcase, std::decimal::decimal{32,64,128} must have a field (the corresponding typedef float __decfloat32 __attribute__((mode(SD))); (or DD or TD).
If this is the latest libdecnumber, then it needs to be fixed.

That said, gcc shouldn't ICE on invalid sources, so I've filed an upstream bug.

Comment 2 triumphs3 2010-12-09 20:52:44 UTC
(In reply to comment #1)
> This is invalid testcase, std::decimal::decimal{32,64,128} must have a field
> (the corresponding typedef float __decfloat32 __attribute__((mode(SD))); (or DD
> or TD).
> If this is the latest libdecnumber, then it needs to be fixed.
> 
> That said, gcc shouldn't ICE on invalid sources, so I've filed an upstream bug.


I believe that is backwards.  The testcase is valid and the compiler should be fixed.  Your argument is that the name std::decimal::decimal32 is reserved by the implementation and only the may provide the definition of std::decimal::decimal32.  std::string is not reserved by the implementation and one is certainly free to use stlports std::string if they choose.  

The "typedef float __decfloat32 __attribute__((mode(SD)));" inside of the class std::decimal::decimal32 is an implementation detail specific to the implementatio n of decimal32 that is provided by g++ but is certainly not a requirement for an alternative decimal32 implementation.

Comment 3 Jakub Jelinek 2010-12-13 08:41:31 UTC
That view conflicts with the C++ ABI requirement:
http://www.codesourcery.com/archives/cxx-abi-dev/msg02174.html