c2rust icon indicating copy to clipboard operation
c2rust copied to clipboard

wip rewrite address-taken locals

Open oinoom opened this issue 3 years ago • 7 comments

oinoom avatar Aug 29 '22 16:08 oinoom

I checked most of the larger graphs in the snapshot diff and they all look good to me.

spernsteiner avatar Sep 19 '22 16:09 spernsteiner

Have you tested the new AddrOfLocal handling on code with loops or other interesting control flow? The current strategy involves special handling for the first initialization of a variable, and that makes me a bit nervous. Some things I'd particularly like to see:

  • A variable declared and initialized inside a loop: loop { let x = ...; ... &x ... }
  • A variable initialized with a conditional: let x = if cond { ... } else { ... }; ... &x ...
  • A variable that's only conditionally initialized: let mut x; if cond { x = 1; ... &x ... }; x = 2; ... &x ...

spernsteiner avatar Sep 20 '22 23:09 spernsteiner

What does this PR do? Could you update PR title and add a brief description?

kkysen avatar Sep 22 '22 03:09 kkysen

Have you tested the new AddrOfLocal handling on code with loops or other interesting control flow?

No, I will add more snapshot tests for those cases and update you when they are ready.

oinoom avatar Sep 22 '22 03:09 oinoom

What does this PR do? Could you update PR title and add a brief description?

Will do soon, will definitely have it by the time I mark it ready for review for you and others.

oinoom avatar Sep 22 '22 03:09 oinoom

Will do soon, will definitely have it by the time I mark it ready for review for you and others.

Okay, great. I wasn't sure since @spernsteiner already approved.

kkysen avatar Sep 22 '22 03:09 kkysen

Okay, great. I wasn't sure since @spernsteiner already approved.

Yeah, I won't be merging until I have approval for the PR generally. That was just for the snapshot.

oinoom avatar Sep 22 '22 03:09 oinoom

Is there a way to split this PR up more? It's getting quite big. The formatting changes in pointers.rs can at least be done directly to master; I've been meaning to do that.

kkysen avatar Oct 11 '22 16:10 kkysen

Is there a way to split this PR up more? It's getting quite big. The formatting changes in pointers.rs can at least be done directly to master; I've been meaning to do that.

@kkysen I'd rather not, the parts that could be split out are pretty small in comparison to the one big feature. If that were broken up, it would mean merging incomplete functionality / incorrect PDG objects, and so I think it makes sense to land all at once.

oinoom avatar Oct 13 '22 16:10 oinoom

Also, after #637 landed, we have a release snapshot in addition to the existing debug one, so can you add the updates to that one here?

kkysen avatar Oct 17 '22 16:10 kkysen

Snapshot changes look good to me

spernsteiner avatar Oct 17 '22 18:10 spernsteiner

Also, after https://github.com/immunant/c2rust/pull/637 landed, we have a release snapshot in addition to the existing debug one, so can you add the updates to that one here?

Done

oinoom avatar Oct 20 '22 18:10 oinoom

@fw-immunant @kkysen i've squashed things into one commit and will split it up from here, that seems easier than approaching it from the opposite direction

oinoom avatar Oct 20 '22 22:10 oinoom

That seems like a reasonable idea.

kkysen avatar Oct 21 '22 00:10 kkysen