Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* sqrt FPE's and fclose errors
@ 1998-03-19 13:33 Tom Browder
  1998-03-19 14:07 ` Tom Browder
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Browder @ 1998-03-19 13:33 UTC (permalink / raw)
  To: axp-list, linux-alpha

I am getting errors (segv) when using
fclose on a file pointer (alpha RH 5.0)--the
same program on a PC Linux (RH 4.2) causes
no problem. 

Any hints would be greatly appreciated.  


Tom Browder
ASI Systems International
A Division of SRS Technologies, Inc.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sqrt FPE's and fclose errors
  1998-03-19 13:33 sqrt FPE's and fclose errors Tom Browder
@ 1998-03-19 14:07 ` Tom Browder
  1998-03-19 14:30   ` Chris Evans
                     ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Tom Browder @ 1998-03-19 14:07 UTC (permalink / raw)
  To: axp-list, linux-alpha

I should have added that the fclose error ONLY
occurs when using g++, not gcc.

Tom Browder
ASI Systems International
A Division of SRS Technologies, Inc.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sqrt FPE's and fclose errors
  1998-03-19 14:07 ` Tom Browder
@ 1998-03-19 14:30   ` Chris Evans
  1998-03-19 15:25     ` Tom Browder
  1998-03-19 14:48   ` Tom Browder
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Chris Evans @ 1998-03-19 14:30 UTC (permalink / raw)
  To: axp-list; +Cc: linux-alpha, redhat-list


On Thu, 19 Mar 1998, Tom Browder wrote:

[re: fclose() + g++ + RH5.0 = SEG FAULT]

> I should have added that the fclose error ONLY
> occurs when using g++, not gcc.

Hello,

Ah, you too, eh? Yes, this is IMHO a _very serious_ flaw with 5.0 alpha.
It was sufficiently bad I had to downgrade to 4.2. It is a shame to think
the same flaw on Intel would have been fixed in days if not hours.

Perhaps someone at RedHat could look into this? I can provide 5 lines of
C++ to reproduce if neccessary.

Chris


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Re: sqrt FPE's and fclose errors
  1998-03-19 14:07 ` Tom Browder
  1998-03-19 14:30   ` Chris Evans
@ 1998-03-19 14:48   ` Tom Browder
  1998-03-19 15:53     ` s-sumi
  1998-03-19 14:48   ` Martin Ostermann
  1998-03-19 18:38   ` Richard Henderson
  3 siblings, 1 reply; 9+ messages in thread
From: Tom Browder @ 1998-03-19 14:48 UTC (permalink / raw)
  To: axp-list, linux-alpha

On a DEC alpha with RH 5.0, I get a segv
using fclose.

This is the simplest prog which causes the segv:

#include <stdio.h>
main()
{
	FILE *fp;

	fp = fopen("t", "w");
	fclose(fp);
}

If I compile it with

  gcc prob.c

it works; but if I use

  g++ prob.cc

it bombs!

Suggestions?

Tom Browder
ASI Systems International
A Division of SRS Technologies, Inc.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sqrt FPE's and fclose errors
  1998-03-19 14:07 ` Tom Browder
  1998-03-19 14:30   ` Chris Evans
  1998-03-19 14:48   ` Tom Browder
@ 1998-03-19 14:48   ` Martin Ostermann
  1998-03-19 14:58     ` Tom Browder
  1998-03-19 18:38   ` Richard Henderson
  3 siblings, 1 reply; 9+ messages in thread
From: Martin Ostermann @ 1998-03-19 14:48 UTC (permalink / raw)
  To: Tom Browder; +Cc: axp-list

Tom Browder <tbrowde@asi-fwb.com> writes:
> I should have added that the fclose error ONLY
> occurs when using g++, not gcc.

This has been know for months, and I really wonder why it hadn't been
fixed by now. Maybe we should scream  "security flaw!" , and see what
happens ...

Anyway, I was told the cause is a duplication of functions in libc and
somewhere in libstc++ of libg++. Often those libraries aren't really
needed, but since g++ is trying to link them, the wrong functions are
taken. 

Try to use 'gcc' instead of 'g++', this often works. If you get
missing symbols during linking, try 'gcc -lc -lstc++' instead,
(or even 'gcc -lc -lstc++ -lg++', though I havn't used that on jet). 

Also, you could use egcs-1.0.1, or even try out how the freshly
released gcc-2.8.1 works on RH-5.0.

HTH, Martin
-- 
Martin Ostermann                | mailto:ost+sig0@comnets.rwth-aachen.de
Communication Networks          | http://www.comnets.rwth-aachen.de/~ost
Aachen University of Technology | phone: ++49/241/807917
Germany                         | fax: ++49/241/8888242


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sqrt FPE's and fclose errors
  1998-03-19 14:48   ` Martin Ostermann
@ 1998-03-19 14:58     ` Tom Browder
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Browder @ 1998-03-19 14:58 UTC (permalink / raw)
  To: Martin Ostermann; +Cc: axp-list

Thanks for Martin's suggestion, I at least got the
simple program to work by trying

  g++ prob.cc -lc

No more segv!

Tom Browder
ASI Systems International
A Division of SRS Technologies, Inc.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sqrt FPE's and fclose errors
  1998-03-19 14:30   ` Chris Evans
@ 1998-03-19 15:25     ` Tom Browder
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Browder @ 1998-03-19 15:25 UTC (permalink / raw)
  To: Chris Evans; +Cc: axp-list, linux-alpha, redhat-list

Let me repeat that Martin's suggestion to link
with -lc BEFORE all my other libs
apparently SOLVED many problems in addition to the fclose
problem.

Tom Browder
ASI Systems International
A Division of SRS Technologies, Inc.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sqrt FPE's and fclose errors
  1998-03-19 14:48   ` Tom Browder
@ 1998-03-19 15:53     ` s-sumi
  0 siblings, 0 replies; 9+ messages in thread
From: s-sumi @ 1998-03-19 15:53 UTC (permalink / raw)
  To: Tom Browder; +Cc: axp-list, linux-alpha

Hi. 

>>>>> "Tom" == Tom Browder <tbrowde@asi-fwb.com> writes:
Tom> On a DEC alpha with RH 5.0, I get a segv
Tom> using fclose.

Tom> This is the simplest prog which causes the segv:

Tom> #include <stdio.h>
Tom> main()
Tom> {
Tom> 	FILE *fp;

Tom> 	fp = fopen("t", "w");
Tom> 	fclose(fp);
Tom> }

Tom> If I compile it with
Tom>   gcc prob.c
Tom> it works; but if I use
Tom>   g++ prob.cc
Tom> it bombs!
Tom> Suggestions?

Miss-matching _IO_dump_t structure between libc.a and libstd++.a
causes this problem. 

It seems that configuration program of libg++/libio does not work well.
Fix this problem, and re-compilation of libg++ is needed.

In libg++-2.7.2/libio directory, the entry of _IO_dump_t structure
defined in libioP.h.
=========================
*** libg++ ***
_G_USING_THUNKS is not defined.

#define JUMP_FIELD(TYPE, NAME) struct { short delta1, delta2; TYPE pfn; } NAME

struct _IO_jump_t {
    JUMP_FIELD(_G_size_t, __dummy);
#ifdef _G_USING_THUNKS
    JUMP_FIELD(_G_size_t, __dummy2);
#endif
    JUMP_FIELD(_IO_finish_t, __finish);
.....
    JUMP_FIELD(_IO_close_t, __close);
    JUMP_FIELD(_IO_stat_t, __stat);
=========================

In glibc-2.0.6/libio/ directory, the entry of _IO_dump_t structure
defined in libioP.h.
=========================
*** libc ***
_G_USING_THUNKS is defined.

#define JUMP_FIELD(TYPE, NAME) TYPE NAME

struct _IO_jump_t {
    JUMP_FIELD(_G_size_t, __dummy);
#ifdef _G_USING_THUNKS
    JUMP_FIELD(_G_size_t, __dummy2);
#endif
    JUMP_FIELD(_IO_finish_t, __finish);
.....
    JUMP_FIELD(_IO_close_t, __close);
    JUMP_FIELD(_IO_stat_t, __stat);
===================================
-----
Shinji Sumimoto    E-Mail: s-sumi@trc.rwcp.or.jp
Real World Computing Partnership 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sqrt FPE's and fclose errors
  1998-03-19 14:07 ` Tom Browder
                     ` (2 preceding siblings ...)
  1998-03-19 14:48   ` Martin Ostermann
@ 1998-03-19 18:38   ` Richard Henderson
  3 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 1998-03-19 18:38 UTC (permalink / raw)
  To: Tom Browder; +Cc: axp-list, linux-alpha

On Thu, Mar 19, 1998 at 08:07:43AM -0600, Tom Browder wrote:
> I should have added that the fclose error ONLY
> occurs when using g++, not gcc.

It is almost FAQ at this point.  C++ is just broken on 5.0.
Please get EGCS if you want a working c++.  There are even srpms:

  ftp.circ.us.eu.org/pub/linux/packages/


r~


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1998-03-19 18:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-03-19 13:33 sqrt FPE's and fclose errors Tom Browder
1998-03-19 14:07 ` Tom Browder
1998-03-19 14:30   ` Chris Evans
1998-03-19 15:25     ` Tom Browder
1998-03-19 14:48   ` Tom Browder
1998-03-19 15:53     ` s-sumi
1998-03-19 14:48   ` Martin Ostermann
1998-03-19 14:58     ` Tom Browder
1998-03-19 18:38   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox