[rtems commit] spglobalcon01: LLVM optimization makes variable i always 1
Daniel Hellstrom
danielh at rtems.org
Fri Aug 24 13:53:12 UTC 2018
Module: rtems
Branch: master
Commit: 97d2c44332e73df730673555f76a403968676d8c
Changeset: http://git.rtems.org/rtems/commit/?id=97d2c44332e73df730673555f76a403968676d8c
Author: Daniel Hellstrom <daniel at gaisler.com>
Date: Fri Jun 29 14:24:58 2018 +0200
spglobalcon01: LLVM optimization makes variable i always 1
Declare i volatile to avoid compiler optimization putting i
into data section with initialization value 1.
---
testsuites/sptests/spglobalcon01/init.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testsuites/sptests/spglobalcon01/init.cc b/testsuites/sptests/spglobalcon01/init.cc
index aee9d0a..f31ceca 100644
--- a/testsuites/sptests/spglobalcon01/init.cc
+++ b/testsuites/sptests/spglobalcon01/init.cc
@@ -27,10 +27,10 @@ class A {
++i;
}
- static int i;
+ static volatile int i;
};
-int A::i;
+volatile int A::i;
static A a;
More information about the vc
mailing list