[Bug c++/56518] Segmentation fault

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 4 12:53:00 GMT 2013


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|WORKSFORME                  |FIXED
      Known to fail|                            |4.6.4

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-04 12:52:43 UTC ---
The ICE is

#0  0x00000000007bafa2 in c_common_signed_or_unsigned_type (unsignedp=1, 
    type=0x0)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/c-family/c-common.c:3018
#1  0x00000000007bfe47 in shorten_compare (op0_ptr=0x7fffffffcb80, 
    op1_ptr=0x7fffffffcb78, restype_ptr=0x7fffffffcb70, 
    rescode_ptr=0x7fffffffcb6c)
    at /space/rguenther/src/svn/gcc-4_6-branch/gcc/c-family/c-common.c:3567

3562      else if (unsignedp0 == unsignedp1 && real1 == real2
3563               && TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION
(*restype_ptr)
3564               && TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION
(*restype_ptr))
3565        {
3566          type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1));
3567          type = c_common_signed_or_unsigned_type (unsignedp0
3568                                                   || TYPE_UNSIGNED
(*restype_ptr),
3569                                                   type);

which ends up calling cp_common_type which has (still also on trunk):

static tree
cp_common_type (tree t1, tree t2)
{
...
  if (SCOPED_ENUM_P (t1) || SCOPED_ENUM_P (t2))
    {
      if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
        return build_type_attribute_variant (t1, attributes);
      else
        return NULL_TREE;
    }

but common_type () is not expected to return NULL_TREE.

ISTR this bug, it got fixed for 4.7+.



More information about the Gcc-bugs mailing list