This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11237] New: Internal Compiler Error (segfault) in convert_from_reference at cvt.c:568


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Internal Compiler Error (segfault) in
                    convert_from_reference at cvt.c:568
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ehrhardt@mathematik.uni-ulm.de
                CC: gcc-bugs@gcc.gnu.org,stip@mathematik.uni-ulm.de

The code ICEs all versions of gcc since 2.95 and up to 3.4. 
The ICE is in this piece of code in cvt.c where we have type == NULL:

tree
convert_from_reference (val)
     tree val;
{
  tree type = TREE_TYPE (val);

  if (TREE_CODE (type) == OFFSET_TYPE)
    type = TREE_TYPE (type);
  if (TREE_CODE (type) == REFERENCE_TYPE)
    return build_indirect_ref (val, NULL);
  return val;
}

Comeau's C++ compiler accepts the code in strict C++ mode.

Here's the code:

-------------------- cut -----------------------------
template <bool V, class T>
struct restrictTo {
	typedef T type;
};

template <typename T, typename U>
struct isDifferentType
{
        static const bool value = true;
};

template <class D>
class ConstDenseVector { };

class MultiIndex { };

template <class C>
void operator+(ConstDenseVector<long> u, ConstDenseVector<long> v)
{ }

template <typename U, typename V>
typename restrictTo< true || isDifferentType< V, V >::value, void>::type
operator+(U u, V v)
{
    operator+<long>(u, u);
}

int
main()
{
    ConstDenseVector<long> v;
    MultiIndex mi;
    v + mi;
}
-------------------- cut -----------------------------

   regards  Christian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]