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

asmparser doesn't report errors it finds #1258

Closed
lattner opened this issue Aug 25, 2006 · 8 comments
Closed

asmparser doesn't report errors it finds #1258

lattner opened this issue Aug 25, 2006 · 8 comments
Labels

Comments

@lattner
Copy link
Collaborator

lattner commented Aug 25, 2006

Bugzilla Link 886
Resolution FIXED
Resolved on Feb 22, 2010 12:54
Version trunk
OS All
Blocks llvm/llvm-bugzilla-archive#895

Extended Description

This .ll file is buggy (%X isn't defined):

ulong %foo(ulong %x) { 
         %tmp.1 = load long* %X          ; [#uses=1]
        %tmp.3 = cast long %tmp.1 to ubyte              ; [#uses=1]
        %tmp.4 = shl ulong %x, ubyte %tmp.3             ; [#uses=1]
        ret ulong %tmp.4
}

When parsing it, I don't get a good error from the asmparser, I get assertion failures.

I could have sworn this used to be caught.

-Chris

@lattner
Copy link
Collaborator Author

lattner commented Oct 8, 2006

Reid, please look into this. This is a really annoying regression from your "remove EH" patch.

You'll notice that running on this .ll file causes the parser to call GenerateError. However, it doesn't print
an error, and it returns the bogus module as though success happened.

-Chris

@llvmbot
Copy link
Member

llvmbot commented Oct 9, 2006

I ran the test case. The error is produced in this production:

Module : FunctionList {
$$ = ParserResult = $1;
CurModule.ModuleDone();
CHECK_FOR_ERROR;
};

When ModuleDone() is finished, the TriggerError flag is true and CHECK_FOR_ERROR
invokes YYERROR. This causes yyparse to return 1. Unfortunately, the RunParser
function was invoking yyparse like this:

yyparse();
if (!ParserResult)
return 0;

This doesn't check for the non-zero result from yyparse because it expects
either an exception or a zero-valued ParserResult to indicate the error. To
correct the problem, this code was changed to:

// Check to make sure the parser succeeded
if (yyparse()) {
if (ParserResult)
delete ParserResult;
return 0;
}

// Check to make sure that parsing produced a result
if (!ParserResult)
return 0;

Which checks both error conditions and returns 0 on them both. This fixes the
problem.

@lattner
Copy link
Collaborator Author

lattner commented Oct 9, 2006

Nice.  Does it also print out the error message with that patch?

@llvmbot
Copy link
Member

llvmbot commented Oct 9, 2006

Yes, the error message is printed correctly. It never hits the validator.

@lattner
Copy link
Collaborator Author

lattner commented Oct 9, 2006

perfect

@llvmbot
Copy link
Member

llvmbot commented Oct 9, 2006

@nlewycky
Copy link
Contributor

mentioned in issue llvm/llvm-bugzilla-archive#895

1 similar comment
@nlewycky
Copy link
Contributor

mentioned in issue llvm/llvm-bugzilla-archive#895

@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
Projects
None yet
Development

No branches or pull requests

3 participants