# Undefined behavior happens when casting string to bool

**URL:** <https://discuss.tvm.apache.org/t/undefined-behavior-happens-when-casting-string-to-bool/11090>\
**Category:** Troubleshooting\
**Created:** [September 21, 2021, 1:20pm UTC](https://discuss.tvm.apache.org/t/undefined-behavior-happens-when-casting-string-to-bool/11090 "2021-09-21T13:20:46Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![syang](https://discuss.tvm.apache.org/user_avatar/discuss.tvm.apache.org/syang/32/2964_2.png) [@syang](https://discuss.tvm.apache.org/u/syang)\
**Post date:** [September 23, 2021, 1:49am UTC](https://discuss.tvm.apache.org/t/undefined-behavior-happens-when-casting-string-to-bool/11090/10 "2021-09-23T01:49:49Z")

</div>

Thanks for your reply! As we have this convention, I agree that fixing this bug in `tir.cast` will be more proper. I will send a PR to enhance the check of casting.

---

_[View the full topic](https://discuss.tvm.apache.org/t/undefined-behavior-happens-when-casting-string-to-bool/11090)._
