[comp.sys.isis] Bugs in interacting with the formatted output conversion functions ?

tc@oxtrap.aa.ox.com (Tse Chih Chao) (11/17/89)

The following small program does not work under isis and it gives the
following  output:

sprintf float is: 0.000000
 printf float is 0.000000
90.25 is : 0.000000
90.25 in fprintf is: 0.000000

It works ok without isis.  It seems to me that there is no separate
xprintf functions defined in the isis libraries.

------------------------cut here---------------------------------------
#include <stdio.h>

maintask()
{
    float  r;
    char   str[50];


    isis_start_done();
    r=90.25;
    
    sprintf(str, "%f", r);
    printf("sprintf float is: %s\n printf float is %f\n", str, r);
    printf("90.25 is : %f\n", 90.25);
    fprintf(stdout, "90.25 in fprintf is: %f\n", 90.25);

    exit();
}

main()
{
    
    isis_init(0);
    isis_task(maintask, "main_task");

    isis_mainloop(maintask);
    exit(0);
}

tc@oxtrap.aa.ox.com (Tse Chih Chao) (11/17/89)

The following small program does not work under isis and it gives the
following  output:

sprintf float is: 0.000000
 printf float is 0.000000
90.25 is : 0.000000
90.25 in fprintf is: 0.000000

It works ok without isis.  It seems to me that there is no separate
xprintf functions defined in the isis libraries.

------------------------cut here---------------------------------------
#include <stdio.h>

maintask()
{
    float  r;
    char   str[50];


    isis_start_done();
    r=90.25;
    
    sprintf(str, "%f", r);
    printf("sprintf float is: %s\n printf float is %f\n", str, r);
    printf("90.25 is : %f\n", 90.25);
    fprintf(stdout, "90.25 in fprintf is: %f\n", 90.25);

    exit();
}

main()
{
    
    isis_init(0);
    isis_task(maintask, "main_task");

    isis_mainloop(maintask);
    exit(0);
}
Path: oxtrap!tc
From: tc@oxtrap.ox.com (Tse Chih Chao)
Message-ID: <TC.89Nov16170316@oxtrap.ox.com>
Date: 16 Nov 89 17:03:16
Organization: Ocwen Trading Inc. - Ann Arbor, MI
Path: oxtrap!tc
From: tc@oxtrap.ox.com (Tse Chih Chao)
Message-ID: <TC.89Nov16165416@oxtrap.ox.com>
Date: 16 Nov 89 16:54:16
Organization: Ocwen Trading Inc. - Ann Arbor, MI
Newsgroups: comp.sys.isis
Subject: Bugs in interacting with the formatted output conversion functions ?
Distribution: comp


The following small program does not work under isis and it gives the
following  output:

sprintf float is: 0.000000
 printf float is 0.000000
90.25 is : 0.000000
90.25 in fprintf is: 0.000000

It works ok without isis.  It seems to me that there is no separate
xprintf functions defined in the isis libraries.

------------------------cut here---------------------------------------
#include <stdio.h>

maintask()
{
    float  r;
    char   str[50];


    isis_start_done();
    r=90.25;
    
    sprintf(str, "%f", r);
    printf("sprintf float is: %s\n printf float is %f\n", str, r);
    printf("90.25 is : %f\n", 90.25);
    fprintf(stdout, "90.25 in fprintf is: %f\n", 90.25);

    exit();
}

main()
{
    
    isis_init(0);
    isis_task(maintask, "main_task");

    isis_mainloop(maintask);
    exit(0);
}
Newsgroups: comp.sys.isis
Subject: Bugs in interacting with the formatted output conversion functions ?
Expires: 
References: 
Sender: 
Reply-To: tc@oxtrap.UUCP (Tse Chih Chao)
Followup-To: 
Distribution: 
Organization: Ocwen Trading, Inc.
Keywords: 



The following small program does not work under isis and it gives the
following  output:

sprintf float is: 0.000000
 printf float is 0.000000
90.25 is : 0.000000
90.25 in fprintf is: 0.000000

It works ok without isis.  It seems to me that there is no separate
xprintf functions defined in the isis libraries.

------------------------cut here---------------------------------------
#include <stdio.h>

maintask()
{
    float  r;
    char   str[50];


    isis_start_done();
    r=90.25;
    
    sprintf(str, "%f", r);
    printf("sprintf float is: %s\n printf float is %f\n", str, r);
    printf("90.25 is : %f\n", 90.25);
    fprintf(stdout, "90.25 in fprintf is: %f\n", 90.25);

    exit();
}

main()
{
    
    isis_init(0);
    isis_task(maintask, "main_task");

    isis_mainloop(maintask);
    exit(0);
}

ken@gvax.cs.cornell.edu (Ken Birman) (11/17/89)

In article <1989Nov16.221608.29876@oxtrap.aa.ox.com> tc@oxtrap.aa.ox.com (Tse Chih Chao) writes:
>
>
>The following small program does not work under isis and it gives the
>following  output:
>
>sprintf float is: 0.000000
> printf float is 0.000000
>90.25 is : 0.000000
>90.25 in fprintf is: 0.000000
>
>It works ok without isis.  It seems to me that there is no separate
>xprintf functions defined in the isis libraries.
>
>------------------------cut here---------------------------------------
>#include <stdio.h>
>
>maintask()
>{
>    float  r;
>    char   str[50];
>
>
>    isis_start_done();
>    r=90.25;
>    
>    sprintf(str, "%f", r);
>    printf("sprintf float is: %s\n printf float is %f\n", str, r);
>    printf("90.25 is : %f\n", 90.25);
>    fprintf(stdout, "90.25 in fprintf is: %f\n", 90.25);
>
>    exit();
>}
>
>main()
>{
>    
>    isis_init(0);
>    isis_task(maintask, "main_task");
>
>    isis_mainloop(maintask);
>    exit(0);
>}
>Path: oxtrap!tc
>From: tc@oxtrap.ox.com (Tse Chih Chao)
>Message-ID: <TC.89Nov16170316@oxtrap.ox.com>
>Date: 16 Nov 89 17:03:16
>Organization: Ocwen Trading Inc. - Ann Arbor, MI
>Path: oxtrap!tc
>From: tc@oxtrap.ox.com (Tse Chih Chao)
>Message-ID: <TC.89Nov16165416@oxtrap.ox.com>
>Date: 16 Nov 89 16:54:16
>Organization: Ocwen Trading Inc. - Ann Arbor, MI
>Newsgroups: comp.sys.isis
>Subject: Bugs in interacting with the formatted output conversion functions ?
>Distribution: comp
>
>
>The following small program does not work under isis and it gives the
>following  output:
>
>sprintf float is: 0.000000
> printf float is 0.000000
>90.25 is : 0.000000
>90.25 in fprintf is: 0.000000
>
>It works ok without isis.  It seems to me that there is no separate
>xprintf functions defined in the isis libraries.
>
>------------------------cut here---------------------------------------
>#include <stdio.h>
>
>maintask()
>{
>    float  r;
>    char   str[50];
>
>
>    isis_start_done();
>    r=90.25;
>    
>    sprintf(str, "%f", r);
>    printf("sprintf float is: %s\n printf float is %f\n", str, r);
>    printf("90.25 is : %f\n", 90.25);
>    fprintf(stdout, "90.25 in fprintf is: %f\n", 90.25);
>
>    exit();
>}
>
>main()
>{
>    
>    isis_init(0);
>    isis_task(maintask, "main_task");
>
>    isis_mainloop(maintask);
>    exit(0);
>}
>Newsgroups: comp.sys.isis
>Subject: Bugs in interacting with the formatted output conversion functions ?
>Expires: 
>References: 
>Sender: 
>Reply-To: tc@oxtrap.UUCP (Tse Chih Chao)
>Followup-To: 
>Distribution: 
>Organization: Ocwen Trading, Inc.
>Keywords: 
>
>
>
>The following small program does not work under isis and it gives the
>following  output:
>
>sprintf float is: 0.000000
> printf float is 0.000000
>90.25 is : 0.000000
>90.25 in fprintf is: 0.000000
>
>.... (program followed)

I ran this program on an ISIS system under SUN OS 4.0.3 (a SUN 3/60)
and it gave the correct output.

Some possibilities to explore:

1) ISIS defines a routine called "print"; it does a printf and then
   an fflush(stdout); we use it to get diagnostic output from programs
   that might crash before flushing.

   Could you please compile this program WITHOUT the ISIS libraries
   and check to see if "_print" is defined:
	a) edit to remove calls to isis.	
	b) cc with normal libraries
	c) nm a.out | grep _print

   If so, you are seeing an interation between the ISIS version of
   print and some (non-standard) version in use on your machine.

2) Was this the EXACT code you compiled?  Probably not, since it lacks
   the isis.h include...

3) Are you on a non-standard UNIX system, e.g. one with floating point
   emulation or some other strange feature?  If so, perhaps ISIS interacts
   with that in some way?

4) If all else fails, how about running "cc -S" and looking at the assembler
   output.  If this looks ok, run adb on a core image (generate one with
   *(int*)1 = 99) and see if the instruction sequence should have worked.  Or,
   run dbx and verify that the args to printf are valid ones...

Basically, what I am getting at is that I don't think this is our fault.
If you can give me enough data to reproduce the problem I will post a
fix.

Ken

ken@gvax.cs.cornell.edu (Ken Birman) (11/17/89)

Oops!  Sorry about that long message!  (I have no idea how it happened)
I meant for my posting to look like this:

>In article <1989Nov16.221608.29876@oxtrap.aa.ox.com> tc@oxtrap.aa.ox.com (Tse Chih Chao) writes:
>
>
>The following small program does not work under isis and it gives the
>following  output:
>
>sprintf float is: 0.000000
> printf float is 0.000000
>90.25 is : 0.000000
>90.25 in fprintf is: 0.000000
>
>It works ok without isis.  It seems to me that there is no separate
>xprintf functions defined in the isis libraries.
>
>.... (program followed)

I ran this program on an ISIS system under SUN OS 4.0.3 (a SUN 3/60)
and it gave the correct output.

Some possibilities to explore:

1) ISIS defines a routine called "print"; it does a printf and then
   an fflush(stdout); we use it to get diagnostic output from programs
   that might crash before flushing.

   Could you please compile this program WITHOUT the ISIS libraries
   and check to see if "_print" is defined:
	a) edit to remove calls to isis.	
	b) cc with normal libraries
	c) nm a.out | grep _print

   If so, you are seeing an interation between the ISIS version of
   print and some (non-standard) version in use on your machine.

2) Was this the EXACT code you compiled?  Probably not, since it lacks
   the isis.h include...

3) Are you on a non-standard UNIX system, e.g. one with floating point
   emulation or some other strange feature?  If so, perhaps ISIS interacts
   with that in some way?

4) If all else fails, how about running "cc -S" and looking at the assembler
   output.  If this looks ok, run adb on a core image (generate one with
   *(int*)1 = 99) and see if the instruction sequence should have worked.  Or,
   run dbx and verify that the args to printf are valid ones...

Basically, what I am getting at is that I don't think this is our fault.
If you can give me enough data to reproduce the problem I will post a
fix.

Ken

tc@oxtrap.ox.com (Tse Chih Chao) (11/18/89)

I apologize for my messed up duplicated messages.
Our disk were out of spaces and made my posting looked rejected.

ken@gvax.cs.cornell.edu (Ken Birman) (11/22/89)

In article <1989Nov16.221608.29876@oxtrap.aa.ox.com>
           tc@oxtrap.aa.ox.com (Tse Chih Chao) writes:
>The following small program does not work under isis and it gives the
>following  output:
>   ... example of a problem under a MIPS (DEC 3100) version of ISIS

I reproduced this problem at Cornell and figured out that it was
caused by a minor error in the MIPS port.

The problem is that the stack pointer ISIS is using for spawned
tasks is not double-word aligned and MIPS turns out to care.

To correct this problem, edit the ISIS source file
	clib/cl_task.c

Line 473 currently reads:
	stackp = (char*)((int)stackp & ~0x3);
Change this to:
	stackp = (char*)((int)stackp & ~0x7);

Recompile and your program will run correctly.

Ken Birman