[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:6 Jan 2005 18:54:09 -0000 
Subject:Problem with external single float results fixed. New mathematical and array libraries work 
From:Aaron Sloman 
Volume-ID: 

I wrote previously about incorrect results produced in linux poplog by
eternally loaded functions returning single floats. Originally I thought
this was just a fortran problem. Then

[AS]
> Date: Mon, 3 Jan 2005 19:57:49 +0000 (UTC)
> Subject: single float results: a problem with C also, not just Fortran!
> ...
> So the problem is there in C too (if what I have done is OK).
>
> I apologise for not checking this earlier.
>
> This is actually reassuring as it is likely that some relatively simple
> fix to do with converting a machine float to a pop11 decimal will
> fix the problem, whereas something that worked for C and not for Fortran
> would be more difficult.
> ...

(At one stage I thought the problem occurred on Solaris poplog as well
as Linux poplog, but that was simply due to my mistakes in C programs.)

Eventually Robert Duncan pointed me at the source of the problem and
this led to a fix, which proved *very* simple, thanks to the good
engineering work previously done by poplog developers!

The file $popsrc/aextern.s (for linux on PC) returns float results from
all external function calls in a double float. However this file (which
on linux PCs is linked to sysdefs.p):

    $popsrc/syscomp/sysdefs_linux_elf.p

had

    C_FLOAT_RESULT_SINGLE = true,

which was wrong. So that was changed to false.

That cured the problem for external C programs returning single floats,
but it remained for external fortran programs. That was fixed by
changing the file

    $popsrc/fields.p

to include this command for PC plus Linux (just after a simpler
instruction for ALPHA float results):

    ;;; all PC linux float results are in double form
    FLWEAK Float_val_s_C -> fsv(FD_VAL_SPEC,fdesc)

That was enough (after rebuilding the system) to make external calls
work. The fixed files can be fetched from here

    http://www.cs.bham.ac.uk/research/poplog/bugfixes/
as described in
    http://www.cs.bham.ac.uk/research/poplog/bugfixes/BUGREPORTS

Since this makes everything in the current popvision package work on
linux poplog (as far as I know) I have removed previous warnings about
the problems and rebuilt the package here

    http://www.cs.bham.ac.uk/research/poplog/popvision.tar.gz

(It previously worked only in Solaris poplog, which had had far more
extensive testing over many years. It may all work on Alpha poplog, but
I no longer have access to an Alpha system.)

All the the changes required for this are now in

    http://www.cs.bham.ac.uk/research/poplog/bham-linux-poplog.tar.gz
        19444565 bytes. Built 17.40GMT 6 Jan 2005

All previous versions of linux poplog include the external functioncall
bug.

Aaron