...when there are invalid constraints. When attaching a `TypeConstraint`, in case of error, the trailing pointer that is supposed to point to the constraint is left uninitialized. Sometimes the uninitialized value will be a `nullptr`, but at other times it will not. If we traverse the AST (for instance, dumping it, or when writing the BMI), we may get a crash depending on the value that was left. The serialization may also contain a bogus value. In this commit, we always initialize the `PlaceholderTypeConstraint` with `nullptr`, to avoid accessing this uninitialized memory. This does not affect only modules, but it causes a segfault more consistently when they are involved. The test case was reduced from `mp-units`. --------- Co-authored-by: Erich Keane <ekeane@nvidia.com>
119 KiB
119 KiB