On Tue, 2013-04-30 at 07:56 -0700, Jon Taylor wrote:
> Not an exact copy, but:
> 
> 
> variable buf:line;
> variable i:integer;
> 
> 
> begin
> 
> 
> file_open(fstatus, readfile, temp_string, read_mode);
> if (fstatus = OPEN_OK) then
> while not (endfile(readfile)) loop
>  readline(readfile, buf);
>  read(buf, i);
> [...]

That isn't a testcase. This is a testcase : it should just compile and
run, and report what it's doing.

-------------------------------------------------------------
entity Jon is
end Jon;

use std.textio.all;

architecture Taylor of Jon is

begin

process is
  variable buf:line;
  variable i:integer;
--  variable s : string(1 to 12);
  variable s : string(1 to 1);

  variable fstatus : file_open_status;
  file readfile : text; 
  constant temp_string : string := "hello.txt";
begin
   file_open(fstatus, readfile, temp_string, read_mode);
   report "open " & file_open_status'image(fstatus) severity note;
   if fstatus = OPEN_OK then
      while not endfile(readfile) loop
         readline(readfile, buf);
--         read(buf, i);
--         report "i= "& integer'image(i) severity note;
         read(buf, s);
         report "s= "& s severity note;         
      end loop;
   end if;
   report "done" severity note;
   wait;
end process;

end Taylor;
-------------------------------------------------------------
and test data "hello.txt"
-------------------------------------------------------------
1
2 
hello
3
-------------------------------------------------------------

And I can't see the problems you describe : reading integers would fail
at line 3 of course. 

> ../../../src/std/textio_body.v93:1329:5:@0ms:(assertion failure):
> string read failure

I suspect these string read failures occur where the line does not
contain enough data to fill the string; that's the only way I have found
to reproduce them. But that is expected behaviour, not a (GHDL) error.

> I don't know if the two errors are related, but they occur at ther
> same line of code.

I still haven't seen the first "error" so I don't know what it is. If
you can modify the testcase to produce it - OR the one you reported as
https://gna.org/bugs/?20771, please post that, we may be able to find
answers to these. 

But we can be reasonably sure that conflicts with libc aren't involved.

- Brian




> 
> ...which compiles, so I assume that the read() of an integer is
> properly overloaded with a function that can handle integers.  No EOF
> condition and at least 4 bytes of data left, as far as I can see.
>  Also, a new wierd error when reading from files: I switched the file
> contents to textual representation of numbers instead of binary
> (replacing the read(buf, [intvar]) with read(buf, [stringvar]) instead
> (which also compiles fine), and at runtime I see this:
> 
> 
> ../../../src/std/textio_body.v93:1329:5:@0ms:(assertion failure):
> string read failure
> 
> 
> 
> I don't know if the two errors are related, but they occur at ther
> same line of code.
> 
> 
> Jon
> 
> 
> 
> 
> On Mon, Apr 29, 2013 at 1:45 PM, Brian Drummond
> <[email protected]> wrote:
>         On Mon, 29 Apr 2013 10:12:03 -0700, you wrote:
>         
>         >I have a NULL pointer crash occuring on a read() call:
>         >
>         >read(linevar, intvar);
>         >
>         >There should be no (normal) way this could compile and then
>         not run
>         >correctly.  Any ideas?
>         >
>         >Jon
>         
>         
>         Again, as with the other bug you reported; any chance of a
>         small testcase?
>         
>         Thanks,
>         - Brian
>         
>         _______________________________________________
>         Ghdl-discuss mailing list
>         [email protected]
>         https://mail.gna.org/listinfo/ghdl-discuss
>         
> 
> 



_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to