Skip to content

LLVM miscompiles a function from Wine #8933

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

Closed
llvmbot opened this issue Nov 7, 2010 · 8 comments
Closed

LLVM miscompiles a function from Wine #8933

llvmbot opened this issue Nov 7, 2010 · 8 comments
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug llvm:codegen

Comments

@llvmbot
Copy link
Member

llvmbot commented Nov 7, 2010

Bugzilla Link 8561
Resolution INVALID
Resolved on Oct 14, 2012 15:28
Version trunk
OS All
Blocks llvm/llvm-bugzilla-archive#10638
Attachments LLVM IR of miscompiled function from Wine
Reporter LLVM Bugzilla Contributor
CC @asl

Extended Description

Now that #8790 is fixed (thanks, Chris!), I took a stab at building Wine with Clang at -O2. It builds successfully, but unfortunately, the resulting Wine segfaults on start-up. This happens before Wine installs its own signal handlers, so the OS picks it up and produces a backtrace. The backtrace pointed to the "reserve_area" function.

I've isolated this function and compiled it to LLVM IR. I don't know where or why this is happening, but this is preventing Wine from being usable when compiled at -O2.

From looking at the source, this function is a recursive function, so that could have something to do with it.

@lattner
Copy link
Collaborator

lattner commented Jan 16, 2011

Hi Charles. I'd like to investigate this, but the testcase is invalid.

$ llc mmap.ll -o -
llc: mmap.ll:64:1: error: expected instruction opcode
}
^

after fixing that:

$ llc mmap.ll -o -
llc: mmap.ll:38:13: error: use of undefined value '@wine_mmap_add_reserved_area'
call void @​wine_mmap_add_reserved_area(i8* %addr, i32 %3)
^

@llvmbot
Copy link
Member Author

llvmbot commented Jan 16, 2011

LLVM IR of entire source file from Wine
All right, here's the IR for the entire source file. I checked out that llc works on it.

@llvmbot
Copy link
Member Author

llvmbot commented Jan 16, 2011

The problem is still present in trunk, by the way.

@llvmbot
Copy link
Member Author

llvmbot commented Jan 16, 2011

LLVM IR of miscompiled function from Wine
That last attachment was a bit much. It had debug info and everything in it.

Here's one without any debug info, and only the stuff needed to compile @​reserve_area. That should be a little more manageable. I ran this through llc as well just to make sure it wasn't malformed.

@llvmbot
Copy link
Member Author

llvmbot commented Mar 18, 2011

Still present in trunk.

I compiled Wine with Clang at -O1 just now (with Clang trunk), and it runs just fine (i.e. no stack overflow, no segfault). The problem must be one of the optimization passes that gets enabled at -O2.

@llvmbot
Copy link
Member Author

llvmbot commented May 11, 2011

Reduced LLVM IR of miscompiled reserve_area()
OK, I've run bugpoint on a modified version of the testcase, and I've produced this reduced testcase. Hope that helps.

@llvmbot
Copy link
Member Author

llvmbot commented Feb 14, 2012

Seems to work at:
git-svn-id: http://llvm.org/svn/llvm-project/llvm/trunk@150433 91177308-0d34-0410-b5e6-96231b3b80d8

and wine-1.4-rc3-23-gd548af4.

There's a crash on first start of wine, that's bug 9844. After that though, at least basic stuff works. Charles, please confirm.

@llvmbot
Copy link
Member Author

llvmbot commented Oct 14, 2012

Yeah, it works. Resolving old bug that turns out not to be a bug in LLVM at all. (Sorry it took so long to get back on this...)

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 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 invalid Resolved as invalid, i.e. not a bug llvm:codegen
Projects
None yet
Development

No branches or pull requests

2 participants