public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/63226] New: ICE with -flto-odr-type-merging
@ 2014-09-11 13:48 burnus at gcc dot gnu.org
  2014-09-11 19:01 ` [Bug lto/63226] " hubicka at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-09-11 13:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

            Bug ID: 63226
           Summary: ICE with -flto-odr-type-merging
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org

The ICE depends on Honza's no-yet committed patch:
https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00878.html

With that patch (and hence -flto-odr-type-merging), one gets the following ICE:

$ g++ -c -flto one12.ii two10.ii
$ g++ -flto -flto-odr-type-merging one12.o two10.ii


lto1: internal compiler error: in odr_types_equivalent_p, at ipa-devirt.c:1066
0x815714 odr_types_equivalent_p
        ../../gcc/ipa-devirt.c:1066
0x815a3e add_type_duplicate
        ../../gcc/ipa-devirt.c:1116


Note: -Wodr doesn't warn for this test case.


With the files one12.ii:
----------------------------------------
class ONE;
class OneClass {
  ONE *swpmi;
  OneClass ();
};
typedef struct ynodetype_t *ynode;
typedef struct ynodetype_t {
  union {
    struct { ynode child1, child3; } i;
  } y;
} ynodetype;
class ONE {
  union _xynode { ynode yn; } ;
};
OneClass::OneClass () { }
----------------------------------------

two10.ii:
----------------------------------------
class ONE;
class TwoClass {
  ONE *swpci;
  TwoClass ();
};
typedef struct ynodetype_t *ynode;
typedef struct { } yleaftype;
typedef struct ynodetype_t {
  union {
    struct { yleaftype leaf; } i;
  } y;
} ynodetype;
typedef ynode ytree;
class ONE {
  ytree Tree;
};
TwoClass::TwoClass () { }
----------------------------------------


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
@ 2014-09-11 19:01 ` hubicka at gcc dot gnu.org
  2014-09-11 20:13 ` hubicka at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-09-11 19:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-09-11
           Assignee|unassigned at gcc dot gnu.org      |hubicka at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Mine.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
  2014-09-11 19:01 ` [Bug lto/63226] " hubicka at gcc dot gnu.org
@ 2014-09-11 20:13 ` hubicka at gcc dot gnu.org
  2014-09-12  0:18 ` hubicka at ucw dot cz
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-09-11 20:13 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4319 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Turning the assert to warning (I probably ought to do that and also compare
alignments) gets me the following:

one.ii:7:16: warning: type �struct ynodetype_t� violates one definition rule
[-Wodr]
 typedef struct ynodetype_t {
                ^
two.ii:8:16: note: a type with different size is defined in another translation
unit
 typedef struct ynodetype_t {
                ^
one.ii:9:12: warning: type �struct <anon>� violates one definition rule [-Wodr]
     struct { ynode child1, child3; } i;
            ^
two.ii:10:12: note: a different type is defined in another translation unit
     struct { yleaftype leaf; } i;
            ^
one.ii:9:20: note: the first difference of corresponding definitions is field
�child1�
     struct { ynode child1, child3; } i;
                    ^
two.ii:10:24: note: a field with different name is defined in another
translation unit
     struct { yleaftype leaf; } i;
                        ^
one.ii:12:7: warning: type �struct ONE� violates one definition rule [-Wodr]
 class ONE {
       ^
two.ii:14:7: note: a type with different number of fields is defined in another
translation unit
 class ONE {

I suppose main problem is that we fail to warn on the union. I will dig into
why.
>From gcc-bugs-return-461613-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Sep 11 20:35:43 2014
Return-Path: <gcc-bugs-return-461613-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14165 invoked by alias); 11 Sep 2014 20:35:43 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 14145 invoked by uid 48); 11 Sep 2014 20:35:35 -0000
From: "baradi09 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/63230] New: allocation of deferred length character as derived type component causes internal compiler error
Date: Thu, 11 Sep 2014 20:35:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: baradi09 at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-63230-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-09/txt/msg01447.txt.bz2
Content-length: 1081

https://gcc.gnu.org/bugzilla/show_bug.cgi?idc230

            Bug ID: 63230
           Summary: allocation of deferred length character as derived
                    type component causes internal compiler error
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: baradi09 at gmail dot com

Created attachment 33474
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id3474&actioníit
Source file which triggers the internal compiler error

Trying to allocate a derived type component, which is a deferred length
character variable, causes gfortran (GNU Fortran (GCC) 5.0.0 20140831
(experimental)) throwing the following internal compiler error:

[507]> gfortran m_strings.f90
m_strings.f90:38:0:

       allocate(character(newsize) :: s%chars)
 ^
internal compiler error: in gimplify_expr, at gimplify.c:8583
0x547f08 ???
        ../sysdeps/x86_64/elf/start.S:113
Please submit a full bug report,


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
  2014-09-11 19:01 ` [Bug lto/63226] " hubicka at gcc dot gnu.org
  2014-09-11 20:13 ` hubicka at gcc dot gnu.org
@ 2014-09-12  0:18 ` hubicka at ucw dot cz
  2014-09-12 14:55 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hubicka at ucw dot cz @ 2014-09-12  0:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

--- Comment #4 from Jan Hubicka <hubicka at ucw dot cz> ---
Hi,
this is patch I am testing.  It fixes few issues in the ODR comparsions code
and seems to handle this testcase sanely.

Honza

Index: ipa-devirt.c
===================================================================
--- ipa-devirt.c    (revision 215196)
+++ ipa-devirt.c    (working copy)
@@ -136,8 +136,44 @@ along with GCC; see the file COPYING3.
 #include "intl.h"
 #include "hash-map.h"

+/* Hash based set of pairs of types.  */
+typedef struct
+{
+  tree first;
+  tree second;
+} type_pair;
+
+struct pair_traits : default_hashset_traits
+{
+  static hashval_t
+  hash (type_pair p)
+  {
+    return TYPE_UID (p.first) ^ TYPE_UID (p.second);
+  }
+  static bool
+  is_empty (type_pair p)
+  {
+    return p.first == NULL;
+  }
+  static bool
+  is_deleted (type_pair p ATTRIBUTE_UNUSED)
+    {
+      return false;
+    }
+  static bool
+  equal (const type_pair &a, const type_pair &b)
+    {
+      return a.first==b.first && a.second == b.second;
+    }
+  static void
+  mark_empty (type_pair &e)
+    {
+      e.first = NULL;
+    }
+};
+
 static bool odr_types_equivalent_p (tree, tree, bool, bool *,
-                    hash_set<tree> *);
+                    hash_set<type_pair,pair_traits> *);

 static bool odr_violation_reported = false;

@@ -471,7 +507,7 @@ set_type_binfo (tree type, tree binfo)
 /* Compare T2 and T2 based on name or structure.  */

 static bool
-odr_subtypes_equivalent_p (tree t1, tree t2, hash_set<tree> *visited)
+odr_subtypes_equivalent_p (tree t1, tree t2, hash_set<type_pair,pair_traits>
*visited)
 {
   bool an1, an2;

@@ -489,29 +525,39 @@ odr_subtypes_equivalent_p (tree t1, tree
   if (an1 != an2 || an1)
     return false;

-  /* For types where we can not establish ODR equivalency (either by ODR names
-     or by virtual tables), recurse and deeply compare.  */
-  if ((!odr_type_p (t1) || !odr_type_p (t2))
-      && (TREE_CODE (t1) != RECORD_TYPE || TREE_CODE (t2) != RECORD_TYPE
-          || !TYPE_BINFO (t1) || !TYPE_BINFO (t2)
-          || !polymorphic_type_binfo_p (TYPE_BINFO (t1))
-          || !polymorphic_type_binfo_p (TYPE_BINFO (t2))))
+  /* For ODR types be sure to compare their names.  */
+  if ((odr_type_p (t1) && !odr_type_p (t2))
+      || (TREE_CODE (t1) == RECORD_TYPE && TREE_CODE (t2) == RECORD_TYPE
+          && TYPE_BINFO (t1) && TYPE_BINFO (t2)
+          && polymorphic_type_binfo_p (TYPE_BINFO (t1))
+          && polymorphic_type_binfo_p (TYPE_BINFO (t2))))
     {
-      if (TREE_CODE (t1) != TREE_CODE (t2))
-    return false;
-      if ((TYPE_NAME (t1) == NULL_TREE) != (TYPE_NAME (t2) == NULL_TREE))
-    return false;
-      if (TYPE_NAME (t1) && DECL_NAME (TYPE_NAME (t1)) != DECL_NAME (TYPE_NAME
(t2)))
-    return false;
-      /* This should really be a pair hash, but for the moment we do not need
-     100% reliability and it would be better to compare all ODR types so
-     recursion here is needed only for component types.  */
-      if (visited->add (t1))
-    return true;
-      return odr_types_equivalent_p (t1, t2, false, NULL, visited);
+      if (!types_same_for_odr (t1, t2))
+        return false;
+      /* Limit recursion: If subtypes are ODR types and we know
+         that they are same, be happy.  */
+      if (!get_odr_type (t1, true)->odr_violated)
+        return true;
     }

-  return types_same_for_odr (t1, t2);
+  /* Component types, builtins and possibly vioalting ODR types
+     have to be compared structurally.  */
+  if (TREE_CODE (t1) != TREE_CODE (t2))
+    return false;
+  if ((TYPE_NAME (t1) == NULL_TREE) != (TYPE_NAME (t2) == NULL_TREE))
+    return false;
+  if (TYPE_NAME (t1) && DECL_NAME (TYPE_NAME (t1)) != DECL_NAME (TYPE_NAME
(t2)))
+    return false;
+
+  type_pair pair={t1,t2};
+  if (TYPE_UID (t1) > TYPE_UID (t2))
+    {
+      pair.first = t2;
+      pair.second = t1;
+    }
+  if (visited->add (pair))
+    return true;
+  return odr_types_equivalent_p (t1, t2, false, NULL, visited);
 }

 /* Compare two virtual tables, PREVAILING and VTABLE and output ODR
@@ -646,16 +692,25 @@ warn_odr (tree t1, tree t2, tree st1, tr
            "type %qT violates one definition rule",
            t1))
     return;
-  if (!st1)
+  if (!st1 && !st2)
     ;
-  else if (TREE_CODE (st1) == FIELD_DECL)
+  /* For FIELD_DECL support also case where one of fields is
+     NULL - this is used when the structures have mismatching number of
+     elements.  */
+  else if (!st1 || TREE_CODE (st1) == FIELD_DECL)
     {
       inform (DECL_SOURCE_LOCATION (decl2),
           "a different type is defined in another translation unit");
+      if (!st1)
+    {
+      st1 = st2;
+      st2 = NULL;
+    }
       inform (DECL_SOURCE_LOCATION (st1),
           "the first difference of corresponding definitions is field %qD",
           st1);
-      decl2 = st2;
+      if (st2)
+        decl2 = st2;
     }
   else if (TREE_CODE (st1) == FUNCTION_DECL)
     {
@@ -710,7 +765,7 @@ warn_types_mismatch (tree t1, tree t2)
    gimple_canonical_types_compatible_p.  */

 static bool
-odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned,
hash_set<tree> *visited)
+odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned,
hash_set<type_pair,pair_traits> *visited)
 {
   /* Check first for the obvious case of pointer identity.  */
   if (t1 == t2)
@@ -834,7 +889,6 @@ odr_types_equivalent_p (tree t1, tree t2
         }
     }

-      /* Tail-recurse to components.  */
       if ((TREE_CODE (t1) == VECTOR_TYPE || TREE_CODE (t1) == COMPLEX_TYPE)
       && !odr_subtypes_equivalent_p (TREE_TYPE (t1), TREE_TYPE (t2), visited))
     {
@@ -846,17 +900,9 @@ odr_types_equivalent_p (tree t1, tree t2
         warn_types_mismatch (TREE_TYPE (t1), TREE_TYPE (t2));
       return false;
     }
-
-      gcc_assert (operand_equal_p (TYPE_SIZE (t1), TYPE_SIZE (t2), 0));
-      gcc_assert (operand_equal_p (TYPE_SIZE_UNIT (t1),
-                   TYPE_SIZE_UNIT (t2), 0));
-      gcc_assert (TYPE_MODE (t1) == TYPE_MODE (t2));
-
-      return true;
     }
-
   /* Do type-specific comparisons.  */
-  switch (TREE_CODE (t1))
+  else switch (TREE_CODE (t1))
     {
     case ARRAY_TYPE:
       {
@@ -896,11 +942,8 @@ odr_types_equivalent_p (tree t1, tree t2
              "in another translation unit"));
         return false;
       }
-    gcc_assert (operand_equal_p (TYPE_SIZE (t1), TYPE_SIZE (t2), 0));
-    gcc_assert (operand_equal_p (TYPE_SIZE_UNIT (t1),
-                     TYPE_SIZE_UNIT (t2), 0));
       }
-      return true;
+    break;

     case METHOD_TYPE:
     case FUNCTION_TYPE:
@@ -1013,9 +1056,20 @@ odr_types_equivalent_p (tree t1, tree t2
            are not the same.  */
         if (f1 || f2)
           {
-        warn_odr (t1, t2, NULL, NULL, warn, warned,
-              G_("a type with different number of fields "
-                 "is defined in another translation unit"));
+        if (f1 && DECL_ARTIFICIAL (f1))
+          f1 = NULL;
+        if (f2 && DECL_ARTIFICIAL (f2))
+          f2 = NULL;
+        if (f1 || f2)
+          warn_odr (t1, t2, f1, f2, warn, warned,
+                G_("a type with different number of fields "
+                   "is defined in another translation unit"));
+        /* Ideally we should never get this generic message.  */
+        else
+          warn_odr (t1, t2, f1, f2, warn, warned,
+                G_("a type with different memory representation "
+                   "is defined in another translation unit"));
+        
         return false;
           }
         if ((TYPE_MAIN_VARIANT (t1) == t1 || TYPE_MAIN_VARIANT (t2) == t2)
@@ -1063,17 +1117,35 @@ odr_types_equivalent_p (tree t1, tree t2
             return false;
           }
           }
-        gcc_assert (operand_equal_p (TYPE_SIZE (t1), TYPE_SIZE (t2), 0));
-        gcc_assert (operand_equal_p (TYPE_SIZE_UNIT (t1),
-                     TYPE_SIZE_UNIT (t2), 0));
       }
-
-    return true;
+    break;
       }

     default:
       gcc_unreachable ();
     }
+
+  /* Those are better to come last as they are utterly uninformative.  */
+  if (TYPE_SIZE (t1) && TYPE_SIZE (t2)
+      && !operand_equal_p (TYPE_SIZE (t1), TYPE_SIZE (t2), 0))
+    {
+      warn_odr (t1, t2, NULL, NULL, warn, warned,
+        G_("a type with different size "
+           "is defined in another translation unit"));
+      return false;
+    }
+  if (COMPLETE_TYPE_P (t1) && COMPLETE_TYPE_P (t2)
+      && TYPE_ALIGN (t1) != TYPE_ALIGN (t2))
+    {
+      warn_odr (t1, t2, NULL, NULL, warn, warned,
+        G_("a type with different alignment "
+           "is defined in another translation unit"));
+      return false;
+    }
+  gcc_assert (!TYPE_SIZE_UNIT (t1) || !TYPE_SIZE_UNIT (t2)
+          || operand_equal_p (TYPE_SIZE_UNIT (t1),
+                  TYPE_SIZE_UNIT (t2), 0));
+  return true;
 }

 /* TYPE is equivalent to VAL by ODR, but its tree representation differs
@@ -1106,7 +1178,7 @@ add_type_duplicate (odr_type val, tree t
       bool base_mismatch = false;
       unsigned int i,j;
       bool warned = false;
-      hash_set<tree> visited;
+      hash_set<type_pair,pair_traits> visited;

       gcc_assert (in_lto_p);
       vec_safe_push (val->types, type);


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-09-12 14:55 ` burnus at gcc dot gnu.org
@ 2014-09-12 14:55 ` burnus at gcc dot gnu.org
  2014-09-12 15:02 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-09-12 14:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 33478
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33478&action=edit
Second test file pair (1/2): one37.ii

         namespace std {
           template<typename _Arg, typename _Result>     struct unary_function 
   {
   };
         }
               namespace mpl_ {
         }
               namespace mpl_ {
         template< bool C_ > struct bool_ {
      };
    template< typename T, T N > struct integral_c;
    }
               namespace boost {
    namespace mpl {
   using ::mpl_::integral_c;
   }
    }
               namespace mpl_ {
         template< typename T, T N > struct integral_c {
          static const T value = N;
      };
         }
               namespace boost{
         template <class T, T val> struct integral_constant : public
mpl::integral_c<T, val> {
   };
         namespace detail {
      template <typename T> struct cv_traits_imp {
        typedef T unqualified_type;
    };
      };
         template< typename T > struct is_void :
::boost::integral_constant<bool,false> {
   };
         template< typename T > struct is_integral :
::boost::integral_constant<bool,false> {
   };
         namespace type_traits {
      template <typename T> struct is_mem_fun_pointer_impl {
  static const bool value = false;
  };
      }
         template< typename T > struct remove_cv {
      typedef typename boost::detail::cv_traits_imp<T*>::unqualified_type type;
      };
         template< typename T > struct is_member_function_pointer :
::boost::integral_constant<bool,::boost::type_traits::is_mem_fun_pointer_impl<typename
remove_cv<T>::type>::value> {
   };
         template< typename T > struct is_member_pointer :
::boost::integral_constant<bool,::boost::is_member_function_pointer<T>::value>
{
   };
         namespace type_traits {
      template <bool b1, bool b2, bool b3 = true, bool b4 = true, bool b5 =
true, bool b6 = true, bool b7 = true> struct ice_and;
      template <bool b1, bool b2, bool b3, bool b4, bool b5, bool b6, bool b7>
struct ice_and {
        static const bool value = false;
    };
      template <bool b> struct ice_not {
  static const bool value = true;
  };
      }
         namespace detail {
      template< typename T > struct is_pointer_helper {
  static const bool value = false;
  };
      template< typename T > struct is_pointer_impl {
  static const bool value = (::boost::type_traits::ice_and<
::boost::detail::is_pointer_helper<typename remove_cv<T>::type>::value ,
::boost::type_traits::ice_not< ::boost::is_member_pointer<T>::value >::value
>::value)          ;
  };
      }
         template< typename T > struct is_pointer :
::boost::integral_constant<bool,::boost::detail::is_pointer_impl<T>::value> {
   };
         namespace mpl {
      template<       bool C     , typename T1     , typename T2     > struct
if_c {
    };
      template<       typename T1     , typename T2     > struct
if_c<false,T1,T2> {
        typedef T2 type;
    };
      }
           template <bool B, class T = void>   struct enable_if_c {
          typedef T type;
        };
           template<typename Signature> class function;
           namespace detail {
          namespace function {
          union function_buffer       {           mutable void (*func_ptr)();  
      };
          struct function_ptr_tag {  };
          template<typename F>       class get_function_tag       {          
typedef typename mpl::if_c<(is_pointer<F>::value),                             
      function_ptr_tag,                                   
function_ptr_tag>::type ptr_or_obj_tag;         public:         typedef
ptr_or_obj_tag type;         };
          template<typename Functor>       struct functor_manager       {      
  public:         static inline void         manage(const function_buffer&
in_buffer, function_buffer& out_buffer)         {  }         };
          struct vtable_base       {           void (*manager)(const
function_buffer& in_buffer,                         function_buffer&
out_buffer);         };
        }
        }
         class function_base {
      };
           namespace detail {
          namespace function {
          template<         typename FunctionObj,         typename R ,        
typename T0       >       struct function_obj_invoker1       {           static
R invoke(function_buffer& function_obj_ptr ,                         T0 a0)    
    {           }         };
          template<         typename FunctionObj,         typename R ,        
typename T0       >       struct void_function_obj_invoker1       {         };
          template<         typename FunctionObj,         typename R ,        
typename T0        >       struct get_function_obj_invoker1       {          
typedef typename mpl::if_c<(is_void<R>::value),                            
void_function_obj_invoker1<                             FunctionObj,           
                 R ,                             T0                          
>,                           function_obj_invoker1<                            
FunctionObj,                             R ,                             T0    
                      >                        >::type type;         };
          template<typename Tag>       struct get_invoker1 {          
template<typename FunctionObj,                  typename R , typename T0>      
  struct apply         {             typedef typename
get_function_obj_invoker1<                              FunctionObj,           
                  R ,                              T0                          
 >::type             invoker_type;             typedef
functor_manager<FunctionObj> manager_type;           };         };
          template<typename R , typename T0>       struct basic_vtable1       {
          typedef R result_type;           typedef result_type
(*invoker_type)(function_buffer&                                             , 
                                           T0);         vtable_base base;      
    invoker_type invoker;         };
        }
        }
           template<     typename R ,     typename T0   >   class function1 :
public function_base        {
      typedef boost::detail::function::basic_vtable1<               R , T0>    
  vtable_type;
        public:          template<typename Functor>     function1(Functor f    
                        ,typename enable_if_c<                            
(boost::type_traits::ice_not<                             
(is_integral<Functor>::value)>::value),                                        
int>::type = 0                             ) :       function_base()     {
          typedef typename detail::function::get_function_tag<Functor>::type
tag;
          typedef detail::function::get_invoker1<tag> get_invoker;
          typedef typename get_invoker::                          template
apply<Functor, R ,                         T0>         handler_type;
          typedef typename handler_type::invoker_type invoker_type;
          typedef typename handler_type::manager_type manager_type;
          static vtable_type stored_vtable =         {   {  
&manager_type::manage }  , &invoker_type::invoke };
        }
        };
         template<typename R ,          typename T0> class function<R ( T0)>  
: public function1<R , T0> {
        typedef function1<R , T0> base_type;
      public:      template<typename Functor>   function(Functor f           
,typename enable_if_c<                            
(boost::type_traits::ice_not<                          
(is_integral<Functor>::value)>::value),                        int>::type = 0  
         ) :     base_type(f)   {
      }
      };
         }
           typedef boost::function<void (const char*)> WarningHandler;
           class ParserImpl;
           class MyParser {
           ParserImpl* impl;
       public:                 MyParser ();
       };
           class ParserImpl {
       public:                 ParserImpl (WarningHandler warner);
       };
           static void DisplayWarning (const char* msg) {
    }
           MyParser::MyParser () {
           impl = new ParserImpl(DisplayWarning);
       }


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-09-12  0:18 ` hubicka at ucw dot cz
@ 2014-09-12 14:55 ` burnus at gcc dot gnu.org
  2014-09-12 14:55 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-09-12 14:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 33479
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33479&action=edit
Second test file pair (1/2): two22.ii


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-09-12 14:55 ` burnus at gcc dot gnu.org
@ 2014-09-12 15:02 ` burnus at gcc dot gnu.org
  2014-09-15 15:03 ` [Bug lto/63226] [5 Regression] " trippels at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-09-12 15:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #5)
> Created attachment 33478 [details]
> Second test file pair (1/2): one37.ii

Mixed up the fields ... That should have been the attachment - and the
attachment should have been the comment.

Still, if you take the code of comment 5 together with attachment 33479, one
can still reproduce it.

Here what I actually wanted to write (and is in the attachment):
----------------------------------------------------------------

(In reply to Jan Hubicka from comment #4)
> this is patch I am testing.  It fixes few issues in the ODR comparsions code
> and seems to handle this testcase sanely.

Thanks. Works for the two files (also for the two files of the big program).
However, the big program (as a whole) still fails with the ICE:
internal compiler error: in odr_types_equivalent_p, at ipa-devirt.c:1125

g++ -O0 -w -c -std=c++11 -flto one37.ii two22.ii; g++ -flto one37.o two22.o


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] [5 Regression] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-09-12 15:02 ` burnus at gcc dot gnu.org
@ 2014-09-15 15:03 ` trippels at gcc dot gnu.org
  2014-09-19 21:40 ` hubicka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-09-15 15:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mliska at suse dot cz

--- Comment #8 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
*** Bug 63270 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] [5 Regression] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-09-15 15:03 ` [Bug lto/63226] [5 Regression] " trippels at gcc dot gnu.org
@ 2014-09-19 21:40 ` hubicka at gcc dot gnu.org
  2014-09-22 11:58 ` trippels at gcc dot gnu.org
  2014-09-24 21:39 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: hubicka at gcc dot gnu.org @ 2014-09-19 21:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #9 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Tobias, does your big program work now?  Also if you have testsuite ready
testcases, I think we can plug them in with -Wno-odr at least (still lacking
way to test LTO time warnings)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] [5 Regression] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-09-19 21:40 ` hubicka at gcc dot gnu.org
@ 2014-09-22 11:58 ` trippels at gcc dot gnu.org
  2014-09-24 21:39 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: trippels at gcc dot gnu.org @ 2014-09-22 11:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

Markus Trippelsdorf <trippels at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
                 CC|                            |trippels at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #10 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
marxin added a testcase in r215451.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug lto/63226] [5 Regression] ICE with -flto-odr-type-merging
  2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2014-09-22 11:58 ` trippels at gcc dot gnu.org
@ 2014-09-24 21:39 ` burnus at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-09-24 21:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63226

--- Comment #11 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #9)
> Tobias, does your big program work now?

I have just tested it - and it works now. Thanks!

> Also if you have testsuite ready testcases, I think we can plug them in with
> -Wno-odr at least (still lacking way to test LTO time warnings)

I don't have any. But marxin has at least commit a test case for the ICE.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-09-24 21:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 13:48 [Bug lto/63226] New: ICE with -flto-odr-type-merging burnus at gcc dot gnu.org
2014-09-11 19:01 ` [Bug lto/63226] " hubicka at gcc dot gnu.org
2014-09-11 20:13 ` hubicka at gcc dot gnu.org
2014-09-12  0:18 ` hubicka at ucw dot cz
2014-09-12 14:55 ` burnus at gcc dot gnu.org
2014-09-12 14:55 ` burnus at gcc dot gnu.org
2014-09-12 15:02 ` burnus at gcc dot gnu.org
2014-09-15 15:03 ` [Bug lto/63226] [5 Regression] " trippels at gcc dot gnu.org
2014-09-19 21:40 ` hubicka at gcc dot gnu.org
2014-09-22 11:58 ` trippels at gcc dot gnu.org
2014-09-24 21:39 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).