Skip to content

Commit

Permalink
Fix issue #325
Browse files Browse the repository at this point in the history
  • Loading branch information
frabert committed May 19, 2023
1 parent c40d377 commit eaf23b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/AST/IRToASTVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ void IRToASTVisitor::VisitFunctionDecl(llvm::Function &func) {
fdecl->addDecl(var);
} else if (inst.hasNUsesOrMore(2) ||
(inst.hasNUsesOrMore(1) && llvm::isa<llvm::CallInst>(inst)) ||
(inst.hasNUsesOrMore(1) && llvm::isa<llvm::LoadInst>(inst)) ||
llvm::isa<llvm::PHINode>(inst)) {
if (!inst.getType()->isVoidTy()) {
auto GetPrefix{[&](llvm::Instruction *inst) {
Expand Down
17 changes: 17 additions & 0 deletions tests/tools/decomp/issue_325_goto.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>
int main(int argc, const char** argv) {
int i = argc;
if (i == 1) { // no args
putchar(4 + '0');
i += 1;
goto n5;
}
if (i > 1) { // args
putchar(5 + '0');
goto n7;
}
n5:
putchar(6 + '0');
n7:
putchar(7 + '0');
}

0 comments on commit eaf23b4

Please sign in to comment.