www.digitalmars.com         C & C++   DMDScript  

D - A problem with streams ).26)

reply John Fletcher <J.P.Fletcher aston.ac.uk> writes:
The following program crashes with a page fault when run under version
0.26

import stream;
//import c.stdio;
import string;
import math;

int main(char[][] args)
{
    char [200] buffer;
    extended x = 1.;
    extended y = 2.;
    File dst = new File;
    dst.create("something");
    return 0;
}

The problem goes away if dst.create() is removed.

I have reported something similar before with an earlier version. There
was a reference then to a different version of stream.d.

System: Win 98, DM says 8.25.1, DMD 0.26

Cheers

John
Apr 10 2002
parent reply "Pavel Minayev" <evilone omen.ru> writes:
There is a bug in compiler which makes programs crash when
function is called from destructor:

    import c.stdio;

    class Foo
    {
     ~this() { printf("dtor\n"); bar(); }
     void bar() { printf("bar\n"); }
    }

    int main()
    {
     Foo foo = new Foo;
    // delete foo;
     return 0;
    }

As you can see, when GC runs, it calls dtor and crashes on call to
bar(). Also note that, if you uncomment delete, the program no longer
crashes - but bar() still isn't called.

This is the case with File: it calls close() from the destructor...
for now, just don't forget to close the file explicitly, and then
use delete to destroy the object before GC does it for you.
Apr 10 2002
parent reply John Fletcher <J.P.Fletcher aston.ac.uk> writes:
Pavel Minayev wrote:

 There is a bug in compiler which makes programs crash when
 function is called from destructor:
(example deleted)
 This is the case with File: it calls close() from the destructor...
 for now, just don't forget to close the file explicitly, and then
 use delete to destroy the object before GC does it for you.
Thank you for this, which helps me understand what is going on. Unfortunately it now crashes at the explicit delete (DMD 0.26, Win98). John
Apr 11 2002
parent reply "Pavel Minayev" <evilone omen.ru> writes:
"John Fletcher" <J.P.Fletcher aston.ac.uk> wrote in message
news:3CB55AD4.45FB4DE6 aston.ac.uk...

 Thank you for this, which helps me understand what is going on.
 Unfortunately it now crashes at the explicit delete (DMD 0.26, Win98).
Strangely enough, it works for me on WinXP. Well, I guess we'll have to wait till next release...
Apr 11 2002
parent reply John Fletcher <J.P.Fletcher aston.ac.uk> writes:
Pavel Minayev wrote:

 "John Fletcher" <J.P.Fletcher aston.ac.uk> wrote in message
 news:3CB55AD4.45FB4DE6 aston.ac.uk...

 Thank you for this, which helps me understand what is going on.
 Unfortunately it now crashes at the explicit delete (DMD 0.26, Win98).
Strangely enough, it works for me on WinXP. Well, I guess we'll have to wait till next release...
It doesn't surprise me. There have been a number of problems with page faults under Win95/98 which don't occur with WinXP. John
Apr 11 2002
parent reply John Fletcher <J.P.Fletcher aston.ac.uk> writes:
John Fletcher wrote:

 Pavel Minayev wrote:

 "John Fletcher" <J.P.Fletcher aston.ac.uk> wrote in message
 news:3CB55AD4.45FB4DE6 aston.ac.uk...

 Thank you for this, which helps me understand what is going on.
 Unfortunately it now crashes at the explicit delete (DMD 0.26, Win98).
Strangely enough, it works for me on WinXP. Well, I guess we'll have to wait till next release...
It doesn't surprise me. There have been a number of problems with page faults under Win95/98 which don't occur with WinXP. John
This was intended to be a bug report. It has no acknowledgement for several days. John
Apr 15 2002
next sibling parent reply "Pavel Minayev" <evilone omen.ru> writes:
"John Fletcher" <J.P.Fletcher aston.ac.uk> wrote in message
news:3CBA9DE7.44ED6716 aston.ac.uk...

 This was intended to be a bug report. It has no acknowledgement for
several
 days.
Do you expect to hear something other than, "will be fixed in the next version"? Walter probably got tired to copy-n-paste it over and over, after the 100th bug report... just wait for the next release.
Apr 15 2002
parent John Fletcher <J.P.Fletcher aston.ac.uk> writes:
Pavel Minayev wrote:

 "John Fletcher" <J.P.Fletcher aston.ac.uk> wrote in message
 news:3CBA9DE7.44ED6716 aston.ac.uk...

 This was intended to be a bug report. It has no acknowledgement for
several
 days.
Do you expect to hear something other than, "will be fixed in the next version"? Walter probably got tired to copy-n-paste it over and over, after the 100th bug report... just wait for the next release.
O.K. Just checking that it had not been missed. There seems to be a pattern emerging where the compilation throws up no errors but the resulting codes behave differently on Windows 98, giving page faults. Walter knows what he has done to solve this in previous cases. I wondered whether this was a manifestation of the same problem or something different. John
Apr 15 2002
prev sibling parent "Walter" <walter digitalmars.com> writes:
"John Fletcher" <J.P.Fletcher aston.ac.uk> wrote in message
 This was intended to be a bug report. It has no acknowledgement for
several
 days.
I added it to the bug list. -Walter
Apr 15 2002