You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2023/01/19 07:50:30 UTC

[GitHub] [nuttx] xiaoxiang781216 commented on pull request #8121: arch:xtensa:toolchain: add -Wno-atmoic-alignment flags

xiaoxiang781216 commented on PR #8121:
URL: https://github.com/apache/nuttx/pull/8121#issuecomment-1396564883

   > @xiaoxiang781216 Could you please share the motivation for disabling this warning? In which scenario does it manifest?
   
   @gustavonihei here is the warning generated by Candance's clang:
   ```
   [2023-01-19T07:31:49.594Z] media_proxy.c:498:9: error: large atomic operation may incur significant performance penalty [-Werror,-Watomic-alignment]
   [2023-01-19T07:31:49.594Z]     if (atomic_load(&priv->refs) == 1 && priv->socket) {
   [2023-01-19T07:31:49.594Z]         ^
   ```
   
   Here is the related struct definition:
   ```
   typedef struct MediaProxyPriv {
       void                  *proxy;
       char                  *cpu;
       uint64_t              handle;
       atomic_int            refs;
       int                   socket;
       void                  *cookie;
       media_event_callback  event;
   } MediaProxyPriv;
   ```
   The warning looks wrong since refs should be naturally alignment.
   
   > 
   > From this Clang patchset, this warning seems useful: https://reviews.llvm.org/D45319
   > 
   > > If an atomic variable is misaligned Clang will emit accesses to it as a libcall. These calls are likely to be slow and involve locks; they are almost certainly not what the developer intended.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org