[riot-notifications] [RIOT-OS/RIOT] core: Fix undefined behaviour in C11 atomics (#11528)

Marian Buschsieweke notifications at github.com
Wed May 15 15:23:59 CEST 2019


maribu commented on this pull request.



> @@ -137,12 +137,12 @@ typedef uint64_t I8;
 #define TEMPLATE_ATOMIC_FETCH_OP_N(opname, op, n, prefixop) \
     I##n __atomic_fetch_##opname##_##n(volatile void *ptr, I##n val, int memmodel) \
     { \
-        unsigned int mask = irq_disable();    \
-        (void)memmodel;                       \
-        I##n tmp = *(I##n *)ptr;              \
-        *(I##n *)ptr = prefixop(tmp op val);  \
-        irq_restore(mask);                    \
-        return tmp;                           \
+        unsigned int mask = irq_disable();              \
+        (void)memmodel;                                 \
+        I##n tmp = *(volatile I##n *)ptr;               \
+        *(volatile I##n *)ptr = prefixop(tmp op val);   \

> They are placed on a column which is a multiple of four.

My bad: A multiple of four plus one. If the line would be empty except for the backslash, the number of spaces would be a multiple of four.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11528#discussion_r284252076
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190515/dbcd4f83/attachment.html>


More information about the notifications mailing list