[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Bug c++/29435] [4.1/4.2 Regression] segmentation fault




------- Comment #10 from pinskia at gcc dot gnu dot org  2006-10-12 03:57 -------
The problem is that we have not layouted out the type yet, if we had with
something like:
template < class T >
struct Rgb{};
Rgb<int> t;
template < int>int Camera1 ()
{
sizeof (Rgb < int>);
}

We don't crash.
Something like this fixes the ICE but I don't know if we should not call
dependent_type_p twice or not, I have not checked if does causes an ICE for the
testcase of PR 29226 or not:
Index: ../../gcc/cp/typeck.c
===================================================================
--- ../../gcc/cp/typeck.c       (revision 117656)
+++ ../../gcc/cp/typeck.c       (working copy)
@@ -1256,6 +1256,9 @@ cxx_sizeof_or_alignof_type (tree type, e
       value = size_one_node;
     }

+  if (!dependent_type_p (type))
+    type = complete_type (type);
+
   if (dependent_type_p (type)
       /* VLA types will have a non-constant size.  In the body of an
         uninstantiated template, we don't need to try to compute the
@@ -1271,7 +1274,7 @@ cxx_sizeof_or_alignof_type (tree type, e
       return value;
     }

-  return c_sizeof_or_alignof_type (complete_type (type),
+  return c_sizeof_or_alignof_type (type,
                                   op == SIZEOF_EXPR,
                                   complain);
 }


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mmitchel at gcc dot gnu dot
                   |                            |org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



Reply to: