[Bug c++/31596] New: Internal compiler error (Segmentation fault)

wolfgang dot roehrl at gi-de dot com gcc-bugzilla@gcc.gnu.org
Tue Apr 17 07:17:00 GMT 2007


Dear all,

I would like to post a bug report for the GNU C/C++ compiler 3.3-e500.

We use the compiler to generate code for a PowerPC processor.

Used invokation line for the GNU C++ compiler:

ccppc -c -x c++ -ansi -Wall -Werror -mcpu=8540 -fverbose-asm -mbig
      -fmerge-templates -mmultiple -mno-string -mstrict-align -O3
      -fno-exceptions -fno-rtti -fno-builtin-printf
      -I<some include paths>
      -D<some #define's>
      X.CPP -oX.O


// file X.CPP

template <typename, typename> class XXX;
template <typename, bool> struct enaFunc;


template <typename T_>
struct enaFunc<T_,true>
{ typedef T_ type; };

template <typename T_>
struct enaFunc<T_,false>
{};


template <typename T_>
struct isXXX
{
    typedef char NO;
    typedef char YES[2];

    template <typename U_, typename V_>
    static YES& check (const XXX<U_,V_>*);

    static NO& check (...);

    enum { value = (sizeof(check(static_cast<T_*>(0))) == sizeof(YES)) };
};


template <typename V_, typename U1_, typename U2_>
typename enaFunc<typename V_::T_RET_TYPE,
                 (isXXX<U1_>::value && isXXX<U2_>::value)
                >::type
func (V_&, U1_&, U2_&);                  // function #1

template <typename V_, typename U1_, typename U2_>
typename enaFunc<typename V_::T_RET_TYPE,
                 (isXXX<U1_>::value && isXXX<U2_>::value)
                >::type
func (const V_&, U1_&, U2_&);            // function #2


struct YYY
{ typedef int T_RET_TYPE; };


void f (const XXX<int,char>& p1, const XXX<bool,int>& p2)
{
    const YYY f = YYY();
    func (f, p1, p2);                    // <--- line 49
}


The compiler crashes with the following message:

X.CPP: In function `void f(const XXX<int, char>&, const XXX<bool, int>&)':
X.CPP:49: internal compiler error: Segmentation fault

(Comeau online compiles the code fragment fine.)

Kind regards
W. Roehrl


-- 
           Summary: Internal compiler error (Segmentation fault)
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wolfgang dot roehrl at gi-de dot com
 GCC build triplet: sparc-sun-solaris2.5.1
  GCC host triplet: i386-pc-mingw32
GCC target triplet: powerpc-wrs-vxworks


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31596



More information about the Gcc-bugs mailing list