c2rust icon indicating copy to clipboard operation
c2rust copied to clipboard

Don't attempt to convert failed constant int evaluations into APint

Open dberlin opened this issue 2 years ago • 1 comments

ASTExporter attempts to convert constant int expressions to actual int values through evaluation.

However, even when evaluation fails, it still attempts to convert the result into an APint, leading to an assertion in APInt (due to trying to convert a none value to APInt).

Fixed by respecting the result of evaluation and exiting if it says no evaluated value was produced.

dberlin avatar Mar 06 '23 19:03 dberlin

Hi, thanks for the PR! Could you provide a test case that triggers the behavior you're describing?

If it's too much trouble to navigate the project's testing infrastructure to add a test case, feel free to just post some code and I'll integrate it into our tests.

fw-immunant avatar May 11 '23 22:05 fw-immunant