summaryrefslogtreecommitdiffstats
path: root/eval_rewrite.tex
diff options
context:
space:
mode:
Diffstat (limited to 'eval_rewrite.tex')
-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}