Skip to content

Default null initialization of REFERENCE TO variables #1260

@volsa

Description

@volsa

we are auto-dereferencing an uninitialized pointer here - this is undefined behaviour. Should we initialize these pointers with null like we are doing for VAR_INPUT {ref}? Ideally we would check for use before assignment but that feature feels a bit far off still.

Originally posted by @mhasel in #1251 (comment)

I think null makes sense here so that we don't have random values. I'm in favour of not having such tests tbh. We can't test undefined behaviour (by design). Also what happens if the random value is 5? I am more in favour of having a test that verifies the pointer value of foo is null. Not sure how to do this with the auto deref rules.. maybe it's enough to have an IR check that verifies the initial values of REFERENCE TO and Pointer fields in general.

Originally posted by @ghaith in #1251 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions