Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilation hangs with -faddress-sanitizer #45

Closed
ramosian-glider opened this issue Aug 31, 2015 · 6 comments
Closed

compilation hangs with -faddress-sanitizer #45

ramosian-glider opened this issue Aug 31, 2015 · 6 comments

Comments

@ramosian-glider
Copy link
Member

Originally reported on Google Code with ID 45

llvm r152415, linux x86_64 
% clang -c -w -faddress-sanitizer  -O2 hang.c
<runs forever>

The test was generated by csmith and reduced by creduce. 
Will investigate later. 

typedef short uint16_t;
struct U2 {
  int:0
}
a = { };
b;
fn1 () {
  struct U2 *c[] = { 0, 0, 0, &a, 0 };
  b = 0;
  for (; b != 52; b = (uint16_t) b + 1) {
    struct U2 **d = &c[8];
    *d = c[1];
  }
}


Reported by konstantin.s.serebryany on 2012-03-11 05:48:05

@ramosian-glider
Copy link
Member Author

(gdb) bt
#0  0x0000000001d70220 in std::less<std::pair<llvm::Type*, llvm::ExprMapKeyType> >::operator()(std::pair<llvm::Type*,
llvm::ExprMapKeyType> const&, std::pair<llvm::Type*, llvm::ExprMapKeyType> const&)
const ()
#1  0x0000000001d72948 in llvm::ConstantUniqueMap<llvm::ExprMapKeyType, llvm::ExprMapKeyType
const&, llvm::Type, llvm::ConstantExpr, false>::FindExistingElement(llvm::ConstantExpr*)
()
#2  0x0000000001d6749f in llvm::ConstantExpr::destroyConstant() ()
#3  0x0000000001d6a22f in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#4  0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#5  0x0000000001d6a226 in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#6  0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#7  0x0000000001d6a226 in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#8  0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#9  0x0000000001d6a226 in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#10 0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#11 0x0000000001d6a226 in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#12 0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#13 0x0000000001d6a226 in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#14 0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#15 0x0000000001d6a226 in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#16 0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#17 0x0000000001d6a226 in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#18 0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
...

#236 0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#237 0x0000000001d6a226 in llvm::ConstantExpr::replaceUsesOfWithOnConstant(llvm::Value*,
llvm::Value*, llvm::Use*) ()
#238 0x0000000001e34fba in llvm::Value::replaceAllUsesWith(llvm::Value*) ()
#239 0x00000000012bcf8c in (anonymous namespace)::AddressSanitizer::insertGlobalRedzones(llvm::Module&)
()
#240 0x00000000012bdfbc in (anonymous namespace)::AddressSanitizer::runOnModule(llvm::Module&)
()
#241 0x0000000001e24181 in llvm::MPPassManager::runOnModule(llvm::Module&) ()
#242 0x0000000001e2430b in llvm::PassManagerImpl::run(llvm::Module&) ()
#243 0x00000000007ba611 in clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction,
llvm::raw_ostream*) ()
#244 0x00000000007b78a9 in clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
()
#245 0x00000000009193d1 in clang::ParseAST(clang::Sema&, bool) ()
#246 0x00000000007b6474 in clang::CodeGenAction::ExecuteAction() ()
#247 0x00000000006596e1 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
()
#248 0x00000000006427d4 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
()
#249 0x0000000000637890 in cc1_main(char const**, char const**, char const*, void*)
()
#250 0x00000000006414d7 in main ()


The stack is growing slowly.

Reported by ramosian.glider on 2012-03-12 11:54:27

@ramosian-glider
Copy link
Member Author

Looks like it is a bug in replaceUsesOfWithOnConstant, which does not stop the recursion
correctly.

Reported by ramosian.glider on 2012-03-12 12:24:48

@ramosian-glider
Copy link
Member Author

The problem isn't reproducible for me with Clang r161319. Shall we close the bug?

Reported by ramosian.glider on 2012-08-06 13:03:39

@ramosian-glider
Copy link
Member Author

I can still see this with llvm r161755

Reported by konstantin.s.serebryany on 2012-08-13 14:31:40

@ramosian-glider
Copy link
Member Author

Looks like this has been solved by waiting. 
On Clang r191885 the compilation passes: 
clang -c -fsanitize=address -w   -O3 ~/tmp/hang.c

Reported by konstantin.s.serebryany on 2013-10-03 13:45:21

  • Status changed: Fixed

@ramosian-glider
Copy link
Member Author

Adding Project:AddressSanitizer as part of GitHub migration.

Reported by ramosian.glider on 2015-07-30 09:12:58

  • Labels added: ProjectAddressSanitizer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant