Pinhas said:
Hi
I am getting an error during ghdl simulation on linux.
NULL access dereferenced.
Has anyone got this error and know how to bypass it?
I've never used ghdl, but I suspect this error is not related to the
simulator, but to the code you're simulating.
If you use an access type (which is the equivalent of a pointer in other
languages, such as C) and try to dereference that while it is NULL, you get
the error as you mentioned.
A simple example of causing such an error would be:
ENTITY null_derefence IS
END ENTITY null_derefence;
USE std.textio.ALL;
ARCHITECTURE behav OF null_derefence IS
BEGIN
doit: PROCESS IS
VARIABLE l: line;
BEGIN
REPORT l.ALL;
WAIT;
END PROCESS doit;
END ARCHITECTURE behav;
Here the access type is line, which is "a pointer" to a string. As it is not
given any value, it is NULL. Dereferencing it (the "l.ALL") gives a nice
alarming run-time error (here in ModelSim):
# ** Fatal: (SIGSEGV) Bad pointer access.
# Time: 0 ps Iteration: 0 Process: /null_derefence/doit File:
null_dereference.vhd Line: UNKNOWN
# Fatal error in Process doit at null_dereference.vhd line 11