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

Global Variable Optimizer segmentation fault on valid input #30402

Closed
llvmbot opened this issue Nov 18, 2016 · 6 comments
Closed

Global Variable Optimizer segmentation fault on valid input #30402

llvmbot opened this issue Nov 18, 2016 · 6 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 18, 2016

Bugzilla Link 31054
Resolution FIXED
Resolved on Jan 10, 2017 12:10
Version trunk
OS Linux
Attachments Reduced testcase with stackstrace and run script
Reporter LLVM Bugzilla Contributor
CC @adrian-prantl,@hfinkel,@MatzeB,@zygoloid

Extended Description

When compiling the attached reduced test case, current clang segfaults with

  1.  <eof> parser at end of file
    
  2.  Per-module optimization passes
    
  3.  Running pass 'Global Variable Optimizer' on module 'report.ii'.
    

Segmentation fault (core dumped)

Full diagnostics in attached test case

It seems that the creation of a static variable after the assert() triggers this.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 18, 2016

assigned to @MatzeB

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 19, 2016

$ ./clang blah.cpp -O0 -emit-llvm -c -std=c++1y produces a module which doesn't pass the verifier.

Global is referenced by parentless instruction!
i64* @&#8203;_ZGVZNK3Baz3fooERKNSt3__110shared_ptrI3FooEEE5stFoo
; ModuleID = 'blah.cpp'
  <badref> = load atomic i8, i8* bitcast (i64* @&#8203;_ZGVZNK3Baz3fooERKNSt3__110shared_ptrI3FooEEE5stFoo to i8*) acquire, align 8
fatal error: error in backend: Broken module found, compilation aborted!

so it could be a bug in the frontend. CC:ing Richard Smith.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 20, 2016

We only run Add DWARF path discriminators before the verifier runs.
I wasn't able to reproduce with opt standalone.

@MatzeB
Copy link
Contributor

MatzeB commented Jan 10, 2017

This is even easier and seems to trigger the same problem:

struct A { ~A(); };

void f(){
return;
static A k;
}

@MatzeB
Copy link
Contributor

MatzeB commented Jan 10, 2017

Seemed easy enough to fix: https://reviews.llvm.org/D28505

@MatzeB
Copy link
Contributor

MatzeB commented Jan 10, 2017

Fix landed in clang r291576

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

2 participants