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

Kaspar Schleiser notifications at github.com
Wed May 15 16:39:50 CEST 2019


kaspar030 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);  \

weird, github still shows this line's last backslash one off, but with a direct checkout, it is alright?

-- 
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#pullrequestreview-237867735
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190515/a84a8199/attachment.html>


More information about the notifications mailing list