From 3e0a352ff5ea20c6cf59be4cb09b223f218f02c3 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 15 Apr 2019 20:36:07 +0200 Subject: Add reproducer for #797 --- testsuite/gna/issue797/main.c | 25 +++++++++++++ testsuite/gna/issue797/pkg_c.vhdl | 71 +++++++++++++++++++++++++++++++++++++ testsuite/gna/issue797/repro.vhdl | 21 +++++++++++ testsuite/gna/issue797/tb.vhdl | 19 ++++++++++ testsuite/gna/issue797/testsuite.sh | 12 +++++++ 5 files changed, 148 insertions(+) create mode 100644 testsuite/gna/issue797/main.c create mode 100644 testsuite/gna/issue797/pkg_c.vhdl create mode 100644 testsuite/gna/issue797/repro.vhdl create mode 100644 testsuite/gna/issue797/tb.vhdl create mode 100755 testsuite/gna/issue797/testsuite.sh (limited to 'testsuite') diff --git a/testsuite/gna/issue797/main.c b/testsuite/gna/issue797/main.c new file mode 100644 index 000000000..a6b9cc21c --- /dev/null +++ b/testsuite/gna/issue797/main.c @@ -0,0 +1,25 @@ +#include +#include +#include + +extern int ghdl_main (int argc, char **argv); + +uint8_t *D[1]; +uintptr_t get_addr(uint8_t id) { return (uintptr_t)D[id]; } +uintptr_t get_baddr(uint8_t id) { return get_addr(id); } + +int main(int argc, char **argv) { + const uint32_t length = 3; + D[0] = (uint8_t *) malloc(2*length*sizeof(uint8_t)); + if ( D[0] == NULL ) { + perror("execution of malloc() failed!\n"); + return -1; + } + int i; + for(i=0; i 1 ns then + set (1, 'a'); + end if; + wait; + end process; +end behav; + diff --git a/testsuite/gna/issue797/tb.vhdl b/testsuite/gna/issue797/tb.vhdl new file mode 100644 index 000000000..2e173fed8 --- /dev/null +++ b/testsuite/gna/issue797/tb.vhdl @@ -0,0 +1,19 @@ +use work.pkg_c.all; + +entity test is +end entity; + +architecture tb of test is + constant block_len : natural := 3; +begin + main: process + variable val: integer; + begin + report "HELLO" severity note; + for x in 0 to block_len-1 loop + val := get(x); + set(block_len+x, val+1); + end loop; + wait; + end process; +end architecture; diff --git a/testsuite/gna/issue797/testsuite.sh b/testsuite/gna/issue797/testsuite.sh new file mode 100755 index 000000000..09cae1076 --- /dev/null +++ b/testsuite/gna/issue797/testsuite.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze repro.vhdl +elab_simulate repro + +analyze pkg_c.vhdl + +clean + +echo "Test successful" -- cgit v1.2.3