Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2012 09:18:12 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        freebsd-ports@FreeBSD.org
Cc:        Peter Jeremy <peter@rulingia.com>, Leslie Jensen <leslie@eskk.nu>
Subject:   Re: make failed for editors/libreoffice
Message-ID:  <4FFBD734.5030909@FreeBSD.org>
In-Reply-To: <4FF49F51.8070600@FreeBSD.org>
References:  <4FF15A89.3000204@eskk.nu> <4FF2E349.5000202@FreeBSD.org> <20120704191351.GB70705@server.rulingia.com> <4FF49F51.8070600@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040909020304060906050701
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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 <dim@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!

--------------040909020304060906050701
Content-Type: text/x-diff;
 name="clang-trunk-r159895.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="clang-trunk-r159895.diff"

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.

--------------040909020304060906050701--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FFBD734.5030909>