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

Kaspar Schleiser notifications at github.com
Wed May 15 19:40:18 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);  \

I F5'ed the shit out of this, still shows the missing space. Anyhow, it also doesn't let me upload the screenshot. Anyways, directly checking this out looks fine, so let's go!



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


More information about the notifications mailing list