Calling close on a closed file causes a segmentation fault

14 views
Skip to first unread message

Finnian Reilly

unread,
Feb 15, 2019, 12:39:59 PM2/15/19
to Eiffel Users
Calling close on a closed file causes a segmentation fault

Wondering if anyone else has run into this problem on gcc. I am surprised that I seem to be the first person to have reported it.I figure that if I was not the first then there would already be a precondition on `close' "not is_closed" but when I checked I didn't see such.


Eric Bezault

unread,
Feb 15, 2019, 2:31:42 PM2/15/19
to eiffel...@googlegroups.com, Finnian Reilly
On 15/02/2019 18:39, Finnian Reilly wrote:
> *Calling close on a closed file causes a segmentation fault*
> *
> *
> Wondering if anyone else has run into this problem on gcc. I am
> surprised that I seem to be the first person to have reported it.I
> figure that if I was not the first then there would already be a
> precondition on `close' "not is_closed" but when I checked I didn't see
> such.
>
> https://github.com/EiffelSoftware/EiffelStudio/blob/master/Src/library/base/elks/kernel/file.e
The precondition is inherited from IO_MEDIUM.

--
Eric Bezault
mailto:er...@gobosoft.com
http://www.gobosoft.com

Finnian Reilly

unread,
Feb 15, 2019, 2:35:21 PM2/15/19
to Eiffel Users
I forgot FILE is not top of the hierarchy.

Alexandr Naumchev

unread,
Feb 16, 2019, 12:36:40 AM2/16/19
to Eiffel Users
On 18.07, I get segfaults regularly because of memory allocation failures.

Larry Rix

unread,
Feb 17, 2019, 10:30:57 AM2/17/19
to Eiffel Users
Many of those are because of stale W_Code. I find that I must refreeze more often to avoid these issues. Whether it is needful or not, I tend to do a two-step process: Find All Classes & Recompile (Alt-F8) and then Freeze (Ctrl+F7). It is my experience that it handles a vast majority of stale code related segmentation faults.

The transcompile (Eiffel-to-C/C++-to-Executable) is a complex process that gets derailed mostly because of severe changes I make in the code. It's all well and good to just do a normal compile (F7) for small changes (i.e. code changes to routines or the addition or removal of attribute features). However, if I create new classes, or change a reference from one class to another, and so on, I find that the Alt-F8-then-Ctrl-F7 keeps the W_code as fresh as possible, which generally means I only encounter seg-faults as the exception and not the norm.
Reply all
Reply to author
Forward
0 new messages