Skip to content

transpile: Consider volatile reads a side effect - #1978

Open
Rua wants to merge 4 commits into
immunant:masterfrom
Rua:volatile-read-side-effect
Open

transpile: Consider volatile reads a side effect#1978
Rua wants to merge 4 commits into
immunant:masterfrom
Rua:volatile-read-side-effect

Conversation

@Rua

@Rua Rua commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fixes the issue noted in #1975 (comment), that volatile reads with unused results are omitted when they shouldn't be.

@Rua
Rua force-pushed the volatile-read-side-effect branch 4 times, most recently from d26719b to 8cd218b Compare August 20, 2026 14:53
@Rua
Rua marked this pull request as ready for review August 20, 2026 14:58
@Rua
Rua force-pushed the volatile-read-side-effect branch from 8cd218b to 627f712 Compare August 20, 2026 15:12
@Rua
Rua force-pushed the volatile-read-side-effect branch from 627f712 to 62b90e1 Compare August 22, 2026 08:25
let mut y: bar = bar {
x: x as ::core::ffi::c_int,
} as bar;
let mut y: bar = bar { x: x };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these side effects of the new code, or something that was there before?

// https://github.com/immunant/c2rust/issues/1237
--(volatile_global_struct.p);

// Unused reads, should be included as side effects.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a case for volatile struct member reads?

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.

2 participants