9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] f2c issue
@ 2013-11-21 16:50 Fausto Saporito
  2013-11-21 17:20 ` Jens Staal
  0 siblings, 1 reply; 11+ messages in thread
From: Fausto Saporito @ 2013-11-21 16:50 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

Hello all,

i'm trying to compile f2c (downloaded from NETLIB), under latest Plan9
installed under VirtualBox.
Running arithchk I receive:

arithchk 283: suicide: sys: fp: stack overflow fppc=0xffffbfff
status=0xffff pc=0x000012ea

The emulated CPU is the same of the host CPU: INTEL i7.

Was somebody able to compile f2c under plan9?

thanks,
Fausto

[-- Attachment #2: Type: text/html, Size: 538 bytes --]

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

* Re: [9fans] f2c issue
  2013-11-21 16:50 [9fans] f2c issue Fausto Saporito
@ 2013-11-21 17:20 ` Jens Staal
  2013-11-21 21:37   ` Fausto Saporito
  0 siblings, 1 reply; 11+ messages in thread
From: Jens Staal @ 2013-11-21 17:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Thursday 21 November 2013 17:50:50 Fausto Saporito wrote:
> Hello all,
>
> i'm trying to compile f2c (downloaded from NETLIB), under latest Plan9
> installed under VirtualBox.
> Running arithchk I receive:
>
> arithchk 283: suicide: sys: fp: stack overflow fppc=0xffffbfff
> status=0xffff pc=0x000012ea
>
> The emulated CPU is the same of the host CPU: INTEL i7.
>
> Was somebody able to compile f2c under plan9?
>
> thanks,
> Fausto


Hi

check the one found at

/n/sources/contrib/staal1978/pkg

to compile stuff you probably also need the libf2c

you can also download it on ports2plan9
https://code.google.com/p/ports2plan9/downloads/detail?name=libf2c.pkg.tbz
https://code.google.com/p/ports2plan9/downloads/detail?name=f2c.pkg.tbz





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

* Re: [9fans] f2c issue
  2013-11-21 17:20 ` Jens Staal
@ 2013-11-21 21:37   ` Fausto Saporito
  2013-11-22  8:18     ` Jens Staal
  0 siblings, 1 reply; 11+ messages in thread
From: Fausto Saporito @ 2013-11-21 21:37 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

Hi Jens,

thanks a lot!!! that site is wonderful :-D

regards,
Fausto



2013/11/21 Jens Staal <staal1978@gmail.com>

> On Thursday 21 November 2013 17:50:50 Fausto Saporito wrote:
> > Hello all,
> >
> > i'm trying to compile f2c (downloaded from NETLIB), under latest Plan9
> > installed under VirtualBox.
> > Running arithchk I receive:
> >
> > arithchk 283: suicide: sys: fp: stack overflow fppc=0xffffbfff
> > status=0xffff pc=0x000012ea
> >
> > The emulated CPU is the same of the host CPU: INTEL i7.
> >
> > Was somebody able to compile f2c under plan9?
> >
> > thanks,
> > Fausto
>
>
> Hi
>
> check the one found at
>
> /n/sources/contrib/staal1978/pkg
>
> to compile stuff you probably also need the libf2c
>
> you can also download it on ports2plan9
> https://code.google.com/p/ports2plan9/downloads/detail?name=libf2c.pkg.tbz
> https://code.google.com/p/ports2plan9/downloads/detail?name=f2c.pkg.tbz
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1698 bytes --]

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

* Re: [9fans] f2c issue
  2013-11-21 21:37   ` Fausto Saporito
@ 2013-11-22  8:18     ` Jens Staal
  2013-11-22 12:14       ` Fausto Saporito
  0 siblings, 1 reply; 11+ messages in thread
From: Jens Staal @ 2013-11-22  8:18 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Thursday 21 November 2013 22:37:06 Fausto Saporito wrote:
> Hi Jens,
>
> thanks a lot!!! that site is wonderful :-D
>
> regards,
> Fausto
>
>

Thanks :)

If you want more language support (and more up-to-date fortran, but also ObjC,
COBOL, C++ ...) it is highly recommended to check out the GCC 4.5.4 port made
by Alvaro

http://marcus.biz.tm/jail/

he offers a binary download via Hg. A disadvantage is that the site is somewhat
slow. He will upload a tarball mirror to ports2plan9 soon :)

The disadvantages with gcc are that the libraries need to be built for gcc, so
the real system and the gcc stuff are completely sepparate. Another current
disadvantage is that it is i386 only.




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

* Re: [9fans] f2c issue
  2013-11-22  8:18     ` Jens Staal
@ 2013-11-22 12:14       ` Fausto Saporito
  2013-11-22 14:44         ` erik quanstrom
  0 siblings, 1 reply; 11+ messages in thread
From: Fausto Saporito @ 2013-11-22 12:14 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

Hi Jens,

Thanks for the infos. I prefer to use just pcc and 8c, but I understand the
changes to make to some progs are many in order to compile with pcc.

By the way I have always the same problem (suicide with stack overflow
running arithchk).
I'm thinking this could be related to virtualbox... maybe.

I have to try with a real hardware...

regards.
Fausto


2013/11/22 Jens Staal <staal1978@gmail.com>

> On Thursday 21 November 2013 22:37:06 Fausto Saporito wrote:
> > Hi Jens,
> >
> > thanks a lot!!! that site is wonderful :-D
> >
> > regards,
> > Fausto
> >
> >
>
> Thanks :)
>
> If you want more language support (and more up-to-date fortran, but also
> ObjC,
> COBOL, C++ ...) it is highly recommended to check out the GCC 4.5.4 port
> made
> by Alvaro
>
> http://marcus.biz.tm/jail/
>
> he offers a binary download via Hg. A disadvantage is that the site is
> somewhat
> slow. He will upload a tarball mirror to ports2plan9 soon :)
>
> The disadvantages with gcc are that the libraries need to be built for
> gcc, so
> the real system and the gcc stuff are completely sepparate. Another current
> disadvantage is that it is i386 only.
>
>
>

[-- Attachment #2: Type: text/html, Size: 1760 bytes --]

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

* Re: [9fans] f2c issue
  2013-11-22 12:14       ` Fausto Saporito
@ 2013-11-22 14:44         ` erik quanstrom
  2013-11-22 16:42           ` Fausto Saporito
  0 siblings, 1 reply; 11+ messages in thread
From: erik quanstrom @ 2013-11-22 14:44 UTC (permalink / raw)
  To: fausto.saporito, 9fans

> By the way I have always the same problem (suicide with stack overflow
> running arithchk).

that's not a stack overflow, that's a x87 floating point stack overflow.
if you would post the code around the program counter in your error
message it would be helpful.  asm(*PC) with acid would be even better.

- erik



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

* Re: [9fans] f2c issue
  2013-11-22 14:44         ` erik quanstrom
@ 2013-11-22 16:42           ` Fausto Saporito
  2013-11-22 16:52             ` Federico G. Benavento
                               ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Fausto Saporito @ 2013-11-22 16:42 UTC (permalink / raw)
  To: erik quanstrom; +Cc: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

Hi Erik,

yes, it's a FP stack overflow... :-)
I also tried with 9front, and the error message is slightly different:

./arithchk
#define IEEE_8087
#define Arith_Kind_ASL 1
arithchk 8523: suicide: sys: fp: invalid operation fppc=0x12ee
status=0xb8b3 pc=0x000012f2

further checks reveal that the problem is this function:

 void
get_nanbits(unsigned int *b, int k)
{
union { double d; unsigned int z[2]; } u, u1, u2;

k = 2 - k;
 u1.z[k] = u2.z[k] = 0x7ff00000;
u1.z[1-k] = u2.z[1-k] = 0;
u.d = u1.d - u2.d; /* Infinity - Infinity */ <<<<<<<======  this is the
FATAL ERROR.
 b[0] = u.z[0];
b[1] = u.z[1];
}

called as getnanbits(nanbits,1)

I'm sorry but I don't know how to generate the acid code.

regards,
Fausto



2013/11/22 erik quanstrom <quanstro@quanstro.net>

> > By the way I have always the same problem (suicide with stack overflow
> > running arithchk).
>
> that's not a stack overflow, that's a x87 floating point stack overflow.
> if you would post the code around the program counter in your error
> message it would be helpful.  asm(*PC) with acid would be even better.
>
> - erik
>

[-- Attachment #2: Type: text/html, Size: 2355 bytes --]

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

* Re: [9fans] f2c issue
  2013-11-22 16:42           ` Fausto Saporito
@ 2013-11-22 16:52             ` Federico G. Benavento
  2013-11-22 19:54             ` erik quanstrom
  2013-11-22 22:15             ` Charles Forsyth
  2 siblings, 0 replies; 11+ messages in thread
From: Federico G. Benavento @ 2013-11-22 16:52 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 1627 bytes --]

you might want to disable that exception in main() 
setfcr(getcfr() ~FPOVFL);

sometimes I had to go extreme and do:
setfcr(getfcr() &~ (FPINEX|FPOVFL|FPUNFL|FPZDIV|FPINVAL));
when porting some code that was supposed to run well on unixes.

see getfcr(2).

On Nov 22, 2013, at 2:42 PM, Fausto Saporito <fausto.saporito@gmail.com> wrote:

> Hi Erik,
> 
> yes, it's a FP stack overflow... :-)
> I also tried with 9front, and the error message is slightly different:
> 
> ./arithchk
> #define IEEE_8087
> #define Arith_Kind_ASL 1
> arithchk 8523: suicide: sys: fp: invalid operation fppc=0x12ee status=0xb8b3 pc=0x000012f2
> 
> further checks reveal that the problem is this function:
> 
>  void
> get_nanbits(unsigned int *b, int k)
> {
> 	union { double d; unsigned int z[2]; } u, u1, u2;
> 
> 	k = 2 - k;
> 	u1.z[k] = u2.z[k] = 0x7ff00000;
> 	u1.z[1-k] = u2.z[1-k] = 0;
> 	u.d = u1.d - u2.d;	/* Infinity - Infinity */ <<<<<<<======  this is the FATAL ERROR.
> 	b[0] = u.z[0];
> 	b[1] = u.z[1];
> 	}
> 
> called as getnanbits(nanbits,1)
> 
> I'm sorry but I don't know how to generate the acid code.
> 
> regards,
> Fausto
> 
> 
> 
> 2013/11/22 erik quanstrom <quanstro@quanstro.net>
> > By the way I have always the same problem (suicide with stack overflow
> > running arithchk).
> 
> that's not a stack overflow, that's a x87 floating point stack overflow.
> if you would post the code around the program counter in your error
> message it would be helpful.  asm(*PC) with acid would be even better.
> 
> - erik
> 

—
Federico G. Benavento
benavento@gmail.com




[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 859 bytes --]

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

* Re: [9fans] f2c issue
  2013-11-22 16:42           ` Fausto Saporito
  2013-11-22 16:52             ` Federico G. Benavento
@ 2013-11-22 19:54             ` erik quanstrom
  2013-11-22 21:18               ` Fausto Saporito
  2013-11-22 22:15             ` Charles Forsyth
  2 siblings, 1 reply; 11+ messages in thread
From: erik quanstrom @ 2013-11-22 19:54 UTC (permalink / raw)
  To: fausto.saporito, quanstro, 9fans

> get_nanbits(unsigned int *b, int k)
> {
> union { double d; unsigned int z[2]; } u, u1, u2;
>
> k = 2 - k;
>  u1.z[k] = u2.z[k] = 0x7ff00000;
> u1.z[1-k] = u2.z[1-k] = 0;
> u.d = u1.d - u2.d; /* Infinity - Infinity */ <<<<<<<======  this is the
> FATAL ERROR.
>  b[0] = u.z[0];
> b[1] = u.z[1];
> }
>
> called as getnanbits(nanbits,1)

oh, boy.

we can assume ieee 754.  the pattern you want for the nan is

	u.hi = 0x7ff80000;	/* sign = 0; exp = 1s; msb in signf set */
	u.lo = 0;

you can use FPdbleword in <u.h> for regular plan 9 programs,
and <float.h> for ape programs which will take care of this for you.
in that case, you'd have

void
get_nanbits(unsigned int *b, int)
{
	FPdbleword w;

	assert(sizeof(double) == 8);

	w.hi = 0x7ff80000;
	w.lo = 0;
	memcpy(b, &w, 8);
}



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

* Re: [9fans] f2c issue
  2013-11-22 19:54             ` erik quanstrom
@ 2013-11-22 21:18               ` Fausto Saporito
  0 siblings, 0 replies; 11+ messages in thread
From: Fausto Saporito @ 2013-11-22 21:18 UTC (permalink / raw)
  To: erik quanstrom; +Cc: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 60 bytes --]

Hi Erik and Federico,

thanks a lot!

regards,
Fausto

[-- Attachment #2: Type: text/html, Size: 150 bytes --]

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

* Re: [9fans] f2c issue
  2013-11-22 16:42           ` Fausto Saporito
  2013-11-22 16:52             ` Federico G. Benavento
  2013-11-22 19:54             ` erik quanstrom
@ 2013-11-22 22:15             ` Charles Forsyth
  2 siblings, 0 replies; 11+ messages in thread
From: Charles Forsyth @ 2013-11-22 22:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

On 22 November 2013 16:42, Fausto Saporito <fausto.saporito@gmail.com>wrote:

> yes, it's a FP stack overflow... :-)


often that means that there is a function that should be declared to return
a float or double
but is relying on a default declaration as int, or is declared, but
incorrectly.

[-- Attachment #2: Type: text/html, Size: 629 bytes --]

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

end of thread, other threads:[~2013-11-22 22:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-21 16:50 [9fans] f2c issue Fausto Saporito
2013-11-21 17:20 ` Jens Staal
2013-11-21 21:37   ` Fausto Saporito
2013-11-22  8:18     ` Jens Staal
2013-11-22 12:14       ` Fausto Saporito
2013-11-22 14:44         ` erik quanstrom
2013-11-22 16:42           ` Fausto Saporito
2013-11-22 16:52             ` Federico G. Benavento
2013-11-22 19:54             ` erik quanstrom
2013-11-22 21:18               ` Fausto Saporito
2013-11-22 22:15             ` Charles Forsyth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).