<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Assertion `(PtrWord & ~PointerBitMask) == 0 && "Pointer is not sufficiently aligned"' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=48682">48682</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `(PtrWord & ~PointerBitMask) == 0 && "Pointer is not sufficiently aligned"' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>libclang
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mliska@suse.cz
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>