Skip to content
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

use default initializer for uninitialized globals #363

Merged
merged 1 commit into from
Nov 5, 2021

Conversation

riederm
Copy link
Collaborator

@riederm riederm commented Nov 5, 2021

especially complex global variables (arrays, struct) need
an initial value, or llvm will generate them as a external.
So when accessing that global variable it would result in an
ACCESS_VIOLATION

fixes #361

especially complex global variables (arrays, struct) need
an initial value, or llvm will generate them as a external.
So when accessing that global variable it would result in an
ACCESS_VIOLATION

fixes #361
@riederm
Copy link
Collaborator Author

riederm commented Nov 5, 2021

we had a couple of codegen-tests that expected global external variables which i believe is wrong.
I changed them to have zero-initialized global variables instead:

  • src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__arrays_are_generated.snap
  • src/codegen/tests/snapshots/rusty__codegen__tests__code_gen_tests__arrays_with_global_const_size_are_generated.snap

@riederm riederm requested a review from ghaith November 5, 2021 07:47
@riederm riederm merged commit 124c2cb into master Nov 5, 2021
@riederm riederm deleted the issue-361-GLOBAL_VARIABLES_array_problem branch November 5, 2021 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GLOBAL VARIABLES array problem
2 participants