[llvm-bugs] [Bug 50838] New: error in backend: Misaligned constant address: 0x00000007 has alignment 1, but the memory access requires 4

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 23 20:51:54 PDT 2021


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

            Bug ID: 50838
           Summary: error in backend: Misaligned constant address:
                    0x00000007 has alignment 1, but the memory access
                    requires 4
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: Hexagon
          Assignee: unassignedbugs at nondot.org
          Reporter: natechancellor at gmail.com
                CC: llvm-bugs at lists.llvm.org

When building an ARCH=hexagon allmodconfig Linux kernel, Arnd reported a crash
in kernel/locking/lockdep.c:

$ make -skj"$(nproc)" ARCH=hexagon CROSS_COMPILE=hexagon-linux- LLVM=1
LLVM_IAS=1 O=build/hexagon distclean allmodconfig kernel/locking/lockdep.o
...
fatal error: error in backend: Misaligned constant address: 0x00000007 has
alignment 1, but the memory access requires 4
...

Running cvise on the file spits out:

$ cat lockdep.i
struct list_head {
  struct list_head *next, *prev
};
struct lock_list {
  struct list_head entry;
  int class
} check_prevs_add() {
  struct lock_list *target_entry1 = find_exclusive_match(target_entry1->class);
}

$ clang -O2 --target=hexagon-linux -ftrivial-auto-var-init=pattern -c -o
/dev/null lockdep.i
lockdep.i:2:32: warning: expected ';' at end of declaration list
  struct list_head *next, *prev
                               ^
                               ;
lockdep.i:6:12: warning: expected ';' at end of declaration list
  int class
           ^
           ;
lockdep.i:8:37: warning: implicit declaration of function
'find_exclusive_match' is invalid in C99 [-Wimplicit-function-declaration]
  struct lock_list *target_entry1 = find_exclusive_match(target_entry1->class);
                                    ^
lockdep.i:8:21: warning: incompatible integer to pointer conversion
initializing 'struct lock_list *' with an expression of type 'int'
[-Wint-conversion]
  struct lock_list *target_entry1 = find_exclusive_match(target_entry1->class);
                    ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lockdep.i:9:1: warning: non-void function does not return a value
[-Wreturn-type]
}
^
fatal error: error in backend: Misaligned constant address: 0x00000007 has
alignment 1, but the memory access requires 4
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -O2 --target=hexagon-linux
-ftrivial-auto-var-init=pattern -c -o /dev/null lockdep.i
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'lockdep.i'.
4.      Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on
function '@check_prevs_add'
 #0 0x0000000003008f93 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3008f93)
 #1 0x0000000003006dde llvm::sys::RunSignalHandlers()
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3006dde)
 #2 0x0000000002f90633 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
CrashRecoveryContext.cpp:0:0
 #3 0x0000000002f905af llvm::CrashRecoveryContext::HandleExit(int)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x2f905af)
 #4 0x0000000003003307 llvm::sys::Process::Exit(int, bool)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3003307)
 #5 0x0000000001b18b60
llvm::DenseMapBase<llvm::DenseMap<llvm::AliasSetTracker::ASTCallbackVH,
llvm::AliasSet::PointerRec*, llvm::AliasSetTracker::ASTCallbackVHDenseMapInfo,
llvm::detail::DenseMapPair<llvm::AliasSetTracker::ASTCallbackVH,
llvm::AliasSet::PointerRec*> >, llvm::AliasSetTracker::ASTCallbackVH,
llvm::AliasSet::PointerRec*, llvm::AliasSetTracker::ASTCallbackVHDenseMapInfo,
llvm::detail::DenseMapPair<llvm::AliasSetTracker::ASTCallbackVH,
llvm::AliasSet::PointerRec*> >::destroyAll() cc1_main.cpp:0:0
 #6 0x0000000002f94e82 llvm::report_fatal_error(llvm::Twine const&, bool)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x2f94e82)
 #7 0x0000000002f94f57
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x2f94f57)
 #8 0x0000000001b54ef0
llvm::HexagonTargetLowering::validateConstPtrAlignment(llvm::SDValue,
llvm::SDLoc const&, unsigned int) const HexagonISelLowering.cpp:0:0
 #9 0x0000000001b5b936 llvm::HexagonTargetLowering::LowerLoad(llvm::SDValue,
llvm::SelectionDAG&) const HexagonISelLowering.cpp:0:0
#10 0x0000000001b5d408
llvm::HexagonTargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&)
const HexagonISelLowering.cpp:0:0
#11 0x0000000003d92198 (anonymous
namespace)::SelectionDAGLegalize::LegalizeLoadOps(llvm::SDNode*)
LegalizeDAG.cpp:0:0
#12 0x0000000003d7f9b6 (anonymous
namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#13 0x0000000003d7e931 llvm::SelectionDAG::Legalize()
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3d7e931)
#14 0x0000000003e3edab llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3e3edab)
#15 0x0000000003e3cc1e
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3e3cc1e)
#16 0x0000000003e394a1
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3e394a1)
#17 0x0000000001c62ba4
llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
HexagonISelDAGToDAG.cpp:0:0
#18 0x000000000236490d
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x236490d)
#19 0x00000000027eac58 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x27eac58)
#20 0x00000000027f3121 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x27f3121)
#21 0x00000000027eb751 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x27eb751)
#22 0x00000000036e27cf (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#23 0x00000000036dcf2c clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x36dcf2c)
#24 0x0000000003a14f80
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
CodeGenAction.cpp:0:0
#25 0x0000000004130ca4 clang::ParseAST(clang::Sema&, bool, bool)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x4130ca4)
#26 0x00000000039697e0 clang::FrontendAction::Execute()
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x39697e0)
#27 0x00000000038dcd6f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x38dcd6f)
#28 0x0000000003a0f007
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3a0f007)
#29 0x0000000001b18838 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x1b18838)
#30 0x0000000001b1638d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#31 0x000000000377fc72 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long) Job.cpp:0:0
#32 0x0000000002f90547
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x2f90547)
#33 0x000000000377f7d7
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x377f7d7)
#34 0x0000000003747868
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3747868)
#35 0x0000000003747b37
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3747b37)
#36 0x0000000003760201
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x3760201)
#37 0x0000000001b15c56 main
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x1b15c56)
#38 0x00007f28ea015b25 __libc_start_main (/usr/lib/libc.so.6+0x27b25)
#39 0x0000000001b12ffe _start
(/home/nathan/cbl/github/tc-build/build/llvm/stage1/bin/clang-13+0x1b12ffe)
clang-13: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
ClangBuiltLinux clang version 13.0.0 (https://github.com/llvm/llvm-project
e8c8ce0974edca7bc21ce53826ff7b2c0456d70a)
Target: hexagon-unknown-linux
Thread model: posix
InstalledDir: /home/nathan/cbl/github/tc-build/build/llvm/stage1/bin
clang-13: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

$ clang -O2 --target=hexagon-linux -c -o /dev/null lockdep.i
lockdep.i:2:32: warning: expected ';' at end of declaration list
  struct list_head *next, *prev
                               ^
                               ;
lockdep.i:6:12: warning: expected ';' at end of declaration list
  int class
           ^
           ;
lockdep.i:8:37: warning: implicit declaration of function
'find_exclusive_match' is invalid in C99 [-Wimplicit-function-declaration]
  struct lock_list *target_entry1 = find_exclusive_match(target_entry1->class);
                                    ^
lockdep.i:8:21: warning: incompatible integer to pointer conversion
initializing 'struct lock_list *' with an expression of type 'int'
[-Wint-conversion]
  struct lock_list *target_entry1 = find_exclusive_match(target_entry1->class);
                    ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lockdep.i:9:1: warning: non-void function does not return a value
[-Wreturn-type]
}
^
5 warnings generated.

I can reproduce this with current ToT
(e8c8ce0974edca7bc21ce53826ff7b2c0456d70a).

-- 
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/20210624/2262ec47/attachment.html>


More information about the llvm-bugs mailing list