-
Notifications
You must be signed in to change notification settings - Fork 40
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
Call to enable_result_type_inference
is not safe
#275
Comments
After looking into it a bit more, I now think that this only really happens if you use an unregistered/unloaded dialect, so in that sense it's related to #23. I was writing tests for #274 and was using custom test dialects that weren't registered to MLIR, hence issues ocurred when trying to use operation interfaces such as |
Thanks for the research! I see. The unregistered dialects should be fixed asap... |
Sorry, I closed by mistake! |
Calling
enable_result_type_inference
onOperationBuilder
may trigger undefined behavior if types cannot be inferred, sincemlirOperationCreate
returns anullptr
in this case.OperationBuilder::build
does not check for nullity, and as such an invalidOperation
may be constructed, causing undefined behavior when it is accessed or dropped.Code to reproduce:
Suggested fix: check for nullity before calling
Operation::from_raw
inOperationBuilder::build
and return aResult<Operation, _>
or simply panic.The text was updated successfully, but these errors were encountered: