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

[BUG REPORT] Print error message: A case where the the check_if will always overflow #361

Open
Math-O5 opened this issue Dec 7, 2020 · 8 comments
Assignees
Labels
bug Something isn't working easy Easy problem

Comments

@Math-O5
Copy link
Collaborator

Math-O5 commented Dec 7, 2020

Describe the bug
When user type incomplete programs, the "check_if(tokens[i + 1])" in sim/simc_parse.py will always overflow, if there is not tokens[i + 1].

The program typed by the use is clearly wrong, but the program should treat this properly.

To Reproduce
Complie this simc code:

test.simc:

MAIN
    if()
MAIN
    var
MAIN
    f
MAIN
    array overflow

Ouput error:

...
  File "/home/math-o5/anaconda3/lib/python3.7/site-packages/simc/simc_parser.py", line 673, in check_ptr
    if tokens[i].type == "multiply":
IndexError: list index out of range

Expected behavior
A kind message error for user

Desktop (please complete the following information):

  • OS: Fedora 30, Ubuntu 18
@Math-O5 Math-O5 added the bug Something isn't working label Dec 7, 2020
@Math-O5 Math-O5 changed the title [BUG REPORT] Throwing simc overflow error to user [BUG REPORT] Print error mensage: A case where the the check_if will always overflow Dec 7, 2020
@frankhart2018
Copy link
Member

Yeah currently it just expects something to be there, there should be an index out of range check too in check_if.

@frankhart2018 frankhart2018 added easy Easy problem KWoC'20 These issues are being listed as part of KWoC'20 labels Dec 7, 2020
@frankhart2018
Copy link
Member

Passing the index as argument and processing check_if only if the index is in range will fix this.

@frankhart2018 frankhart2018 changed the title [BUG REPORT] Print error mensage: A case where the the check_if will always overflow [BUG REPORT] Print error message: A case where the the check_if will always overflow Dec 9, 2020
@jigyasudhingra
Copy link
Contributor

I would like to work on this @frankhart2018.

@Math-O5
Copy link
Collaborator Author

Math-O5 commented Dec 9, 2020

@jigyasudhingra All yours. :)

@imHarry404
Copy link

your list is empty and you are trying to compare its index type, but your list is empty so that it is giving the output like that.

@frankhart2018
Copy link
Member

Do you want to work in this @ami-harry

@imHarry404
Copy link

@frankhart2018 yes. I want to work

@frankhart2018
Copy link
Member

Sure assigning this to you too @ami-harry.

@jigyasudhingra jigyasudhingra removed their assignment Dec 28, 2020
@frankhart2018 frankhart2018 removed the KWoC'20 These issues are being listed as part of KWoC'20 label Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easy Easy problem
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants