Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Aug 2021 14:06:02 GMT
From:      Jessica Clarke <jrtc27@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c1f7d8dd23db - main - clang: Build with -fno-strict-aliasing when using GCC
Message-ID:  <202108241406.17OE62Cq074573@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jrtc27:

URL: https://cgit.FreeBSD.org/src/commit/?id=c1f7d8dd23db693106fcd66e0b1766a3f3194670

commit c1f7d8dd23db693106fcd66e0b1766a3f3194670
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-08-24 13:59:36 +0000
Commit:     Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2021-08-24 14:04:25 +0000

    clang: Build with -fno-strict-aliasing when using GCC
    
    Somewhat ironically, there are strict aliasing violations in Clang,
    which can result in the following assertion failure:
    
      Assertion `*(NamedDecl **)&Data == ND && "PointerUnion mangles the NamedDecl pointer!"' failed.
    
    Upstream's clang/CMakeLists.txt specifically (not LLVM as a whole)
    passes -fno-strict-aliasing if the compiler is not Clang, and this fixes
    the above issue.
    
    This was seen when cross-building from Linux using a bootstrap
    compiler, but likely also affects worlds built with a new enough
    external GCC toolchain.
    
    MFC after:      1 week
    Reviewed by:    dim
    Differential Revision:  https://reviews.freebsd.org/D31533
---
 lib/clang/clang.build.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk
index 0d3151178eb9..fb64b16935f2 100644
--- a/lib/clang/clang.build.mk
+++ b/lib/clang/clang.build.mk
@@ -13,4 +13,6 @@ CFLAGS+=	-DCLANG_ENABLE_ARCMT
 CFLAGS+=	-DCLANG_ENABLE_STATIC_ANALYZER
 .endif
 
+CFLAGS.gcc+=	-fno-strict-aliasing
+
 .include "llvm.build.mk"



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