[llvm-bugs] [Bug 48682] New: Assertion `(PtrWord & ~PointerBitMask) == 0 && "Pointer is not sufficiently aligned"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 7 02:54:05 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48682

            Bug ID: 48682
           Summary: Assertion `(PtrWord & ~PointerBitMask) == 0 &&
                    "Pointer is not sufficiently aligned"' failed.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: libclang
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mliska at suse.cz
                CC: klimek at google.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Fails in clang_delta (part of C-Reduce and C-Vise) with LLVM12 only on armv7l:

Reproducer:

$ cat wxe_funcs.ii
static __typeof() a     __attribute__((__weakref__("pthread_mutex_destroy")))

$ valgrind /usr/lib/arm-linux-gnueabihf/clang_delta
--query-instances=replace-function-def-with-decl wxe_funcs.ii

==48917== Memcheck, a memory error detector
==48917== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==48917== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==48917== Command: /usr/lib/arm-linux-gnueabihf/clang_delta
--query-instances=replace-function-def-with-decl wxe_funcs.ii
==48917== 
clang_delta: /usr/lib/llvm-11/include/llvm/ADT/PointerIntPair.h:178: static
intptr_t llvm::PointerIntPairInfo<PointerT, IntBits,
PtrTraits>::updatePointer(intptr_t, PointerT) [with PointerT = clang::Stmt*;
unsigned int IntBits = 1; PtrTraits =
llvm::PointerLikeTypeTraits<clang::Stmt*>; intptr_t = int]: Assertion `(PtrWord
& ~PointerBitMask) == 0 && "Pointer is not sufficiently aligned"' failed.
==48917== 
==48917== Process terminating with default action of signal 6 (SIGABRT)
==48917==    at 0xB442216: __libc_do_syscall (libc-do-syscall.S:47)
==48917==    by 0xB451427: __libc_signal_restore_set (internal-signals.h:104)
==48917==    by 0xB451427: raise (raise.c:47)
==48917==    by 0xB441D55: abort (abort.c:79)
==48917==    by 0xB44C647: __assert_fail_base (assert.c:92)
==48917==    by 0xB44C6D1: __assert_fail (assert.c:101)
==48917==    by 0x969EAF: llvm::PointerIntPairInfo<clang::Stmt*, 1u,
llvm::PointerLikeTypeTraits<clang::Stmt*> >::updatePointer(int, clang::Stmt*)
[clone .part.0] (PointerIntPair.h:178)
==48917==    by 0x972259: updatePointer (SmallVector.h:345)
==48917==    by 0x972259: setPointerAndInt (PointerIntPair.h:76)
==48917==    by 0x972259: PointerIntPair (PointerIntPair.h:54)
==48917==    by 0x972259:
clang::RecursiveASTVisitor<ReplaceFunctionDefWithDeclCollectionVisitor>::TraverseStmt(clang::Stmt*,
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
llvm::PointerLikeTypeTraits<clang::Stmt*>,
llvm::PointerIntPairInfo<clang::Stmt*, 1u,
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*) (RecursiveASTVisitor.h:576)
==48917==    by 0x97F703: TraverseVarDecl (RecursiveASTVisitor.h:2106)
==48917==    by 0x97F703:
clang::RecursiveASTVisitor<ReplaceFunctionDefWithDeclCollectionVisitor>::TraverseVarDecl(clang::VarDecl*)
(RecursiveASTVisitor.h:2106)
==48917==    by 0x96B6EB:
clang::RecursiveASTVisitor<ReplaceFunctionDefWithDeclCollectionVisitor>::TraverseDeclContextHelper(clang::DeclContext*)
[clone .part.0] (RecursiveASTVisitor.h:1383)
==48917==    by 0x96F179: TraverseDeclContextHelper
(RecursiveASTVisitor.h:1377)
==48917==    by 0x96F179: TraverseTranslationUnitDecl
(RecursiveASTVisitor.h:1484)
==48917==    by 0x96F179:
clang::RecursiveASTVisitor<ReplaceFunctionDefWithDeclCollectionVisitor>::TraverseDecl(clang::Decl*)
(DeclNodes.inc:595)
==48917==    by 0x96B661:
ReplaceFunctionDefWithDecl::HandleTranslationUnit(clang::ASTContext&)
(ReplaceFunctionDefWithDecl.cpp:71)
==48917==    by 0x4E58C47: clang::ParseAST(clang::Sema&, bool, bool)
(clang/lib/Parse/ParseAST.cpp:171)

Note that it works for LLVM10 and LLVM8.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210107/0c4afb8d/attachment.html>


More information about the llvm-bugs mailing list