[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: re: [PATCH] Fix const pointer assignment trick on clang 9+
From: David Laight <David.Laight () ACULAB ! COM>
Date: 2021-11-15 11:05:22
Message-ID: 409fc7ad81934748a790cb28755cb24a () AcuMS ! aculab ! com
[Download RAW message or body]
If you are trying to tell the compiler that a pointer
(or other value) might change and it mustn't reload it (etc)
then this might work:
#define LAUNDER(val_in, val_out) \
asm volatile ( "" : "&r" (val_out) : "0" (val_in))
That is (more or less) equivalent to:
val_out = (typeof(val_out))val_in;
except that the compiler can't track the value.
(assuming it doesn't 'peek inside' the asm.)
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic