tests/xics: Ensure no compiler optimisations in delay()
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 17 Jun 2020 12:06:28 +0000 (22:06 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 19 Jun 2020 10:28:03 +0000 (20:28 +1000)
In case it would be tempted to "read ahead" the delay function

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
tests/xics/xics.c

index 46f9a016f81a684f469bf79f142a623012289567..f41c3a41c2efd34a227c3172c017c09b243b93f9 100644 (file)
@@ -12,8 +12,8 @@ void delay(void)
 {
        static volatile int i;
 
-       for (i = 0; i < 10; ++i)
-               ;
+       for (i = 0; i < 16; ++i)
+               __asm__ volatile("" : : : "memory");
 }
 
 void print_number(unsigned int i) // only for i = 0-999