Enzyme icon indicating copy to clipboard operation
Enzyme copied to clipboard

Support `std::list` iteration & modification

Open ax3l opened this issue 5 months ago • 3 comments

Add support for iterating & modifying elements in std::list. Close #2369

  • [x] implement insertion/removal logic
  • [x] add simple list examples
  • [ ] add insertion/removal examples

ax3l avatar Jul 02 '25 02:07 ax3l

@wsmoses there seem to be issues with iterators for the reverse pass (std::list::begin()/end()).

Should iterators work by default, especially since they just work on references and && here, or do they need extra treatment in Enzyme? :)

ax3l avatar Jul 02 '25 15:07 ax3l

it should work perfectly fine, sorry can you point me to the small snippet which fails?

wsmoses avatar Jul 03 '25 04:07 wsmoses

Skipping -O0 for now to go to more important functionality.

I added a test test_modify_list that modifies a value in an existing list, which should mark the modified value in the list as active variable and track it. The runtime result is wrong, as the test still treats the list values as constants. https://fwd.gymni.ch/gLdXSO

I think we need a special treatment for .front()?

ax3l avatar Jul 07 '25 20:07 ax3l