This is an archive of the discontinued LLVM Phabricator instance.

[libomptarget][nfc] Drop __kmpc_data_sharing_slot flexible array member
AbandonedPublic

Authored by JonChesterfield on Aug 20 2020, 6:08 PM.

Details

Summary

[libomptarget][nfc] Drop __kmpc_data_sharing_slot flexible array member

The C99 flexible array member is accepted as an extension in cuda/hip. Accessing
the data[] member of a __kmpc_data_sharing_worker_slot_static through a pointer
to __kmpc_data_sharing_slot.data[] is probably an aliasing violation. Casting the
pointer to the first member is well defined for a standard layout type.

This change is non-functional in practice as the compiler does the right thing
with the aliasing violation and supports the flexible array member from C99.

Diff Detail

Event Timeline

JonChesterfield requested review of this revision.Aug 20 2020, 6:08 PM
  • remove now-dead casts
JonChesterfield edited the summary of this revision. (Show Details)Aug 20 2020, 6:14 PM

This was written as part of debugging a port of the deviceRTL to openmp. It probably isn't necessary for that goal after all, but replacing benign UB with .b in a number of places seems worth having anyway.

openmp/libomptarget/deviceRTLs/common/omptarget.h
85

equivalent to the data[] field, slightly different syntax

JonChesterfield edited the summary of this revision. (Show Details)Aug 20 2020, 6:18 PM
JonChesterfield abandoned this revision.Oct 28 2020, 7:54 AM

This probably doesn't apply against trunk anymore, abandoning.