summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-09-14 23:04:02 +0100
committerYann Herklotz <git@yannherklotz.com>2020-09-14 23:04:02 +0100
commitdb2611d0f0e036a32aab59f4b4fe136d8c545cf2 (patch)
tree3a311587111aa7d2782d3cdb3005cbcb5a2d056c
parent780c03b19a3278bbb176547c4854f45de4c7436f (diff)
downloadfccm21_esrhls-db2611d0f0e036a32aab59f4b4fe136d8c545cf2.tar.gz
fccm21_esrhls-db2611d0f0e036a32aab59f4b4fe136d8c545cf2.zip
Add more
-rw-r--r--eval_rewrite.tex8
1 files changed, 5 insertions, 3 deletions
diff --git a/eval_rewrite.tex b/eval_rewrite.tex
index d1df55b..d51c018 100644
--- a/eval_rewrite.tex
+++ b/eval_rewrite.tex
@@ -101,11 +101,13 @@ In the code above, \texttt{b} has value 1 when run in GCC, but has value 0 when
\subsubsection{Vivado Miscompilation}
-The following code does not output the right value when compiled with Vivado 2019.2 and GCC, as it returns \texttt{0x0} with Vivado whereas it should be returning \texttt{0xF}. This test case is much longer compared to the other test cases that were reduced and could not be made any smaller.
+The following code does not output the right value when compiled with all Vivado versions and GCC, as it returns \texttt{0x0} with Vivado whereas it should be returning \texttt{0xF}. This test case is much longer compared to the other test cases that were reduced and could not be made any smaller, as everything in the code is necessary to trigger the bug.
+
+The array \texttt{a} is initialised to all zeros, as well as the other global variables \texttt{g} and \texttt{c}, so as to not introduce any undefined behaviour. However, \texttt{g} is also assigned the \texttt{volatile} keyword, which ensures that the variable is not optimised away.
\begin{figure}
\begin{minted}{c}
-volatile unsigned int g_2 = 0;
+volatile unsigned int g = 0;
int a[256] = {0};
int c = 0;
@@ -118,7 +120,7 @@ void e(long f) {
int main() {
for (int i = 0; i < 56; i++) a[i] = i;
- e(g_2); e(-2L);
+ e(g); e(-2L);
return c;
}
\end{minted}