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

basicblock_addop Assertion: while-else-loop with try #109719

Closed
15r10nk opened this issue Sep 22, 2023 · 7 comments · Fixed by #109734
Closed

basicblock_addop Assertion: while-else-loop with try #109719

15r10nk opened this issue Sep 22, 2023 · 7 comments · Fixed by #109734
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes release-blocker type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@15r10nk
Copy link
Contributor

15r10nk commented Sep 22, 2023

Bug report

Bug description:

while name_5:
    try:
        break
    except:
        pass
else:
    1 if 1 else 1

output (Python 3.12.0rc3+):

python: Python/flowgraph.c:114: basicblock_addop: Assertion `0 <= oparg && oparg < (1 << 30)' failed.

@iritkatriel I think this looks similar to #109627

I tested this bug with faa8003 and the fix does not solve this issue.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

@15r10nk 15r10nk added the type-bug An unexpected behavior, bug, or error label Sep 22, 2023
@AlexWaygood AlexWaygood added release-blocker type-crash A hard crash of the interpreter, possibly with a core dump 3.12 bugs and security fixes 3.13 bugs and security fixes and removed type-bug An unexpected behavior, bug, or error labels Sep 22, 2023
@sobolevn
Copy link
Member

CC @iritkatriel who fixed a similar problem before

@iritkatriel
Copy link
Member

Thank you, it's the same bug in another place in the compiler. Keep them coming. How are you doing this? With a fuzzer?

1 similar comment
@iritkatriel

This comment was marked as duplicate.

@15r10nk
Copy link
Contributor Author

15r10nk commented Sep 22, 2023

Yes, I wrote pysource-codegen which generates random python code.

I am currently adding 3.12 support and find these bugs more or less on the way.
My current setup is here pysource-playground which combines pysource-codegen and pysource-minimize.

@iritkatriel
Copy link
Member

That's truly awesome. Thank you.

iritkatriel added a commit to iritkatriel/cpython that referenced this issue Sep 22, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 22, 2023
…s cold/warm blocks (pythonGH-109734)

(cherry picked from commit 7c55399)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@gpshead
Copy link
Member

gpshead commented Sep 22, 2023

connecting some dots here as an FYI - https://github.com/Zac-HD/hypothesmith is another python code generator.

It's be neat to have code generation as you've been doing perhaps setup within our oss-fuzz runs.

Yhg1s pushed a commit that referenced this issue Sep 24, 2023
…rs cold/warm blocks (GH-109734) (#109749)

gh-109719: Fix missing jump target labels when compiler reorders cold/warm blocks (GH-109734)
(cherry picked from commit 7c55399)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
@15r10nk
Copy link
Contributor Author

15r10nk commented Sep 27, 2023

hi @gpshead, thank you for the connection.
I already know about hypothesmith. I think that both tools have their own strength.

  • pysource-codegen is limited to the possible output of ast.unparse but can generate larger source files.
  • hypothesmith uses libCST which provides more variation in the generated code, but is limited by the randomness of hypothesis and can not generate larger source files.

oss-fuss is actually new for me. I will look into it. Thank you.

csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes release-blocker type-crash A hard crash of the interpreter, possibly with a core dump
Projects
5 participants