From db2611d0f0e036a32aab59f4b4fe136d8c545cf2 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Mon, 14 Sep 2020 23:04:02 +0100 Subject: Add more --- eval_rewrite.tex | 8 +++++--- 1 file 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} -- cgit