Skip to content

checker: fix: missing check when assignment statement lvalue is ParExpr(fix #19819)#19830

Merged
medvednikov merged 2 commits intovlang:masterfrom
shove70:ptr_unsafe
Nov 11, 2023
Merged

checker: fix: missing check when assignment statement lvalue is ParExpr(fix #19819)#19830
medvednikov merged 2 commits intovlang:masterfrom
shove70:ptr_unsafe

Conversation

@shove70
Copy link
Copy Markdown
Contributor

@shove70 shove70 commented Nov 10, 2023

  1. Fixed Pointer operations must be wrapped in unsafe #19819
  2. Add tests.
  3. Fixed related tests.
c := 0
cref := &c

*cref = 1
(*cref) = 1

outputs:

a.v:4:7: error: modifying variables via dereferencing can only be done in `unsafe` blocks
    2 | cref := &c
    3 | 
    4 | *cref = 1
      |       ^
    5 | (*cref) = 1
    6 |
a.v:5:9: error: modifying variables via dereferencing can only be done in `unsafe` blocks
    3 | 
    4 | *cref = 1
    5 | (*cref) = 1
      |         ^
    6 | 
    7 |

@JalonSolov
Copy link
Copy Markdown
Collaborator

Nifty. All 75 V UI examples are failing... but it doesn't say why.

@shove70
Copy link
Copy Markdown
Contributor Author

shove70 commented Nov 10, 2023

Nifty. All 75 V UI examples are failing... but it doesn't say why.

I guess there are many places where the unsafe block is required

@shove70
Copy link
Copy Markdown
Contributor Author

shove70 commented Nov 11, 2023

This PR needs to be merged first:
vlang/ui#555

@spytheman , thanks a lot.

@medvednikov
Copy link
Copy Markdown
Member

Great work @shove70 !

I've merged the UI PR.

@medvednikov medvednikov merged commit e92d210 into vlang:master Nov 11, 2023
@shove70
Copy link
Copy Markdown
Contributor Author

shove70 commented Nov 11, 2023

Great work @shove70 !

I've merged the UI PR.

thanks a lot.

@shove70 shove70 deleted the ptr_unsafe branch November 11, 2023 10:37
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.

Pointer operations must be wrapped in unsafe

3 participants