------- Comment #2 from burnus at gcc dot gnu dot org 2010-03-31 15:07 ------- Janne, could you please have a look.
* * * The following looks very fishy: gfc_unit * u = find_unit (*unit); ret = (size_t) stell (u->s); pt find_unit(*unit)->s type = struct stream { ssize_t (*read)(struct stream *, void *, ssize_t); ssize_t (*write)(struct stream *, const void *, ssize_t); gfc_offset (*seek)(struct stream *, gfc_offset, int); gfc_offset (*tell)(struct stream *); int (*trunc)(struct stream *, gfc_offset); int (*flush)(struct stream *); int (*close)(struct stream *); } stell (stream * s) { return s->tell (s); **************** And in unix.c: typedef struct { stream st; (...) int fd; /* The POSIX file descriptor. */ raw_tell (unix_stream * s) { return lseek (s->fd, 0, SEEK_CUR); Which only works because of eval casting: buf_init (unix_stream * s) s->st.tell = (void *) buf_tell; * * * I have no idea whether the pointer is initialized correctly, but I can imagine several ways how it could break (e.g. also with LTO) and it makes debugging a mess! -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jb at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43605