[LLVMbugs] [Bug 22587] New: [Linux kernel] crash when building kernel/rcu/tree.c with optimize and debug flags together

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Feb 14 05:45:36 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22587

            Bug ID: 22587
           Summary: [Linux kernel] crash when building kernel/rcu/tree.c
                    with optimize and debug flags together
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: viniciustinti at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13863
  --> http://llvm.org/bugs/attachment.cgi?id=13863&action=edit
Original files and commands described in the bug report.

Clang crashes when building rcu_init_geometry() when using "-g -O2" flags
together. If these flags are removed the code is built successfully.

These bug was notice on r229242 (not sure if is when it happened).
By the LLVMLinux buildbot logs the r229167 does not have this problem. 

==== build command ====
clang-3.7 -cc1 -triple armv7--linux-gnueabihf -S -g -O2 -Wall -o tree.s -x c
tree-minimal.c

==== minimal crash tree.c able to crash ====
static int num_rcu_lvl[] = { 1, (4), 0, 0, 0, };
extern int rcu_num_nodes;
int rcu_num_nodes __attribute__((__section__(".data..read_mostly"))) = ((1 +
(4) + 0 + 0 + 0) - 4);

static void __attribute__ ((__section__(".init.text")))
__attribute__((no_instrument_function)) rcu_init_geometry(void)
{
 int i;
 int j;
 int rcu_capacity[4 + 1];

 for (i = 1; i <= 4; i++)
   for (j = 0; j <= i; j++)
    num_rcu_lvl[j] =
     (((1) + (rcu_capacity[i - j]) - 1) / (rcu_capacity[i - j]));

 rcu_num_nodes = 0;
 for (i = 0; i <= 4; i++)
  rcu_num_nodes += num_rcu_lvl[i];
}

void __attribute__ ((__section__(".init.text")))
__attribute__((no_instrument_function)) rcu_init(void)
{
 rcu_init_geometry();
}

==== crash ====
0  clang-3.7       0x00000000010035c8 llvm::sys::PrintStackTrace(_IO_FILE*) +
40
1  clang-3.7       0x00000000010046ab
2  libpthread.so.0 0x00007fbeda4b2340
3  clang-3.7       0x0000000000af7f44
llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(llvm::AliasAnalysis::Location
const&, bool, llvm::ilist_iterator<llvm::Instruction>, llvm::BasicBlock*,
llvm::Instruction*) + 212
4  clang-3.7       0x0000000000af887c
llvm::MemoryDependenceAnalysis::getDependency(llvm::Instruction*) + 444
5  clang-3.7       0x0000000000f17447
6  clang-3.7       0x0000000000da53eb
llvm::FPPassManager::runOnFunction(llvm::Function&) + 315
7  clang-3.7       0x0000000001634165
8  clang-3.7       0x0000000000da5a1b
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 859
9  clang-3.7       0x00000000013ba2a3
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
7827
10 clang-3.7       0x00000000013b05ce
11 clang-3.7       0x0000000001889f33 clang::ParseAST(clang::Sema&, bool, bool)
+ 467
12 clang-3.7       0x00000000013af59c clang::CodeGenAction::ExecuteAction() +
76
13 clang-3.7       0x000000000117b169 clang::FrontendAction::Execute() + 57
14 clang-3.7       0x000000000114c863
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 803
15 clang-3.7       0x00000000011edbf5
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3141
16 clang-3.7       0x000000000068a89a cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 602
17 clang-3.7       0x0000000000689c79 main + 11721
18 libc.so.6       0x00007fbed96c4ec5 __libc_start_main + 245
19 clang-3.7       0x0000000000686da9
Stack dump:
0.    Program arguments:
/home/tinti/Works/LLVMLinux/llvmlinux/toolchain/clang/head/install/bin/clang-3.7
-cc1 -triple armv7--linux-gnueabihf -S -g -O2 -Wall -o
/home/tinti//Works/LLVMLinux/work/crash_percpu/tree.s -x c
/home/tinti/Works/LLVMLinux/work/crash_percpu/tree-minimal.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module
'/home/tinti/Works/LLVMLinux/work/crash_percpu/tree-minimal.c'.
4.    Running pass 'Dead Store Elimination' on function '@rcu_init_geometry'
tree-minimal.sh: line 1: 21896 Segmentation fault      (core dumped)
/home/tinti/Works/LLVMLinux/llvmlinux/toolchain/clang/head/install/bin/clang-3.7
-cc1 -triple armv7--linux-gnueabihf -S -g -O2 -Wall -o
/home/tinti//Works/LLVMLinux/work/crash_percpu/tree.s -x c
/home/tinti/Works/LLVMLinux/work/crash_percpu/tree-minimal.c

-- 
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/20150214/997c1429/attachment.html>


More information about the llvm-bugs mailing list