On 2012-07-04 21:53, Dimitry Andric wrote:
> On 2012-07-04 21:13, Peter Jeremy wrote:
>> On 2012-Jul-03 14:19:21 +0200, Dimitry Andric <d...@freebsd.org> wrote:
>>> On 2012-07-02 10:23, Leslie Jensen wrote:
>>> ...
>>>> Assertion failed: (EST != EST_Delayed && EST != EST_Uninstantiated), 
>>>> function isNothrow, file 
>>>> /usr/ports/lang/clang/work/llvm-3.1.src/tools/clang/lib/CodeGen/../../include/clang/AST/Type.h,
>>>>  
>>>> line 2873.
...
> I have been mailed a set of .ii files, and I was able to reproduce the
> assert, not only with clang 3.1 release, but also with clang trunk,
> unfortunately.  So it seems a regression; it only happens when you pass
> -std=gnu++11 (or c++11).
> 
> I'm reducing the testcase as I mail this, and I will add it to
> http://llvm.org/bugs/show_bug.cgi?id=12763 (which seems to be the most
> likely bug report for this).

It turned out this particular bug was yet another issue, but it was
fixed by upstream now.  I have a patch ready for -CURRENT, but if anyone
can try it out, and confirm it now allows you to build LibreOffice
without this particular assertion, that would be great. :)

Apply attached patch to your src tree, then build and install clang as
follows (or just do a buildworld/installworld, if you have CPU to
spare):

  make -C /usr/src/lib/clang all
  make -C /usr/src/usr.bin/clang/clang all install

Then retry building the LibreOffice port.  Any feedback appreciated!
Pull in r159895 from upstream clang trunk:

  When marking virtual functions as used for a class' vtable, mark all functions
  which will appear in the vtable as used, not just those ones which were
  declared within the class itself. Fixes an issue reported as comment#3 in
  PR12763 -- we sometimes assert in codegen if we try to emit a reference to a
  function declaration which we've not marked as referenced. This also matches
  gcc's observed behavior.

This should fix clang assertions when building certain components of the
LibreOffice port.


Index: contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp
===================================================================
--- contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp	(revision 238149)
+++ contrib/llvm/tools/clang/lib/Sema/SemaDeclCXX.cpp	(working copy)
@@ -10937,14 +10937,23 @@ bool Sema::DefineUsedVTables() {
 
 void Sema::MarkVirtualMembersReferenced(SourceLocation Loc,
                                         const CXXRecordDecl *RD) {
-  for (CXXRecordDecl::method_iterator i = RD->method_begin(), 
-       e = RD->method_end(); i != e; ++i) {
-    CXXMethodDecl *MD = *i;
+  // Mark all functions which will appear in RD's vtable as used.
+  CXXFinalOverriderMap FinalOverriders;
+  RD->getFinalOverriders(FinalOverriders);
+  for (CXXFinalOverriderMap::const_iterator I = FinalOverriders.begin(),
+                                            E = FinalOverriders.end();
+       I != E; ++I) {
+    for (OverridingMethods::const_iterator OI = I->second.begin(),
+                                           OE = I->second.end();
+         OI != OE; ++OI) {
+      assert(OI->second.size() > 0 && "no final overrider");
+      CXXMethodDecl *Overrider = OI->second.front().Method;
 
-    // C++ [basic.def.odr]p2:
-    //   [...] A virtual member function is used if it is not pure. [...]
-    if (MD->isVirtual() && !MD->isPure())
-      MarkFunctionReferenced(Loc, MD);
+      // C++ [basic.def.odr]p2:
+      //   [...] A virtual member function is used if it is not pure. [...]
+      if (!Overrider->isPure())
+        MarkFunctionReferenced(Loc, Overrider);
+    }
   }
 
   // Only classes that have virtual bases need a VTT.
_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to