stfc / RegentParticleDSL

A particle-method DSL based on Regent programming language
MIT License
1 stars 0 forks source link

[BUG] Tradequeues may not copy array values correctly between particles #89

Closed LonelyCat124 closed 3 years ago

LonelyCat124 commented 3 years ago

The tradequeues copy data with

                        [part_structure:map(function(element)
                            return rquote
                                queue[pos].[element.field] = particles[part].[element.field]
                            end
                         end)];

When the field is an array this will almost certainly not work correctly. For the current DL_MESO this only means the atmnam values will be incorrect. This is unsafe and needs to be fixed for arrays.

LonelyCat124 commented 3 years ago

This might just work, I have a test showing this working as-is (which is somewhat surprising).

LonelyCat124 commented 3 years ago

From talking to Regent developer, this should work correctly:

I think copying arrays should work in general. Terra, unlike C, does not desugar arrays to pointers in function calls and such, so an int32[4] is just a value that happens to be 16 bytes, etc.