bugGNU Octave - Bugs: bug #53853, configure: OCTAVE_BLAS_F77_FUNC...

 
 

bug #53853: configure: OCTAVE_BLAS_F77_FUNC sets ax_blas_integer_size incorrectly on big endian system

Submitter:  Mike Miller <mtmiller>
Submitted:  Sun 06 May 2018 06:30:11 PM UTC
   
 
Category:  Configuration and Build System Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.4.1-rc2 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 10 Aug 2018 07:13:06 AM UTC, comment #17: 
Kai Torben Ohlhus <siko1056>
Group Member
Mon 06 Aug 2018 08:42:01 AM UTC, comment #16: 

If you agree on comment #15, I can push file #44730 myself.

Kai Torben Ohlhus <siko1056>
Group Member
Mon 06 Aug 2018 08:27:15 AM UTC, comment #15: 

Sorry for reopening the issue for my 64-bit builds.  I used a cached version and a clean build revealed this issue for me.

Shouldn't the "else"-branch completely be removed here (lines 66 and 67)?

https://hg.savannah.gnu.org/hgweb/octave/rev/171d90967f16#l1.66

When if and else result in the same, e.g. "STOP 1", what sense does the branch make.  If the else branch was completely removed, the script can terminate without STOP.


$ bash octave_blas_f77_func.sh (with 32 bit BLAS):
           4294967297           1           1
   1.0000000000000000        1.0000000000000000
   1.0000000000000000        1.0000000000000000        1.0000000000000000
STOP 1



$ bash octave_blas_f77_func.sh (with 64 bit BLAS):
           4294967297           1           1
   1.0000000000000000        1.0000000000000000
   1.0000000000000000        1.0000000000000000        4294967297.0000000


At least I was happy then ;-)

Shortly attach a cset.

Kai Torben Ohlhus <siko1056>
Group Member
Wed 18 Jul 2018 06:37:25 PM UTC, comment #14: 

I got three successful builds on x86_64, mips, and s390x, all with 32-bit Fortran integers.

Mike Miller <mtmiller>
Group Member
Wed 18 Jul 2018 12:12:27 PM UTC, comment #13: 

I pushed this change on stable and merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/171d90967f16

John W. Eaton <jwe>
Group administrator
Wed 18 Jul 2018 02:29:15 AM UTC, comment #12: 

The x86_64 build was successful this time. I am currently building for mips, but the configure output looks right to me, the integer size is detected to be 4 bytes and OCTAVE_F77_INT_TYPE is set to int32_t.

I'm not doing any 8-byte integer testing, just making sure configure correctly detects 4-byte integers on both little and big endian builds.

Mike Miller <mtmiller>
Group Member
Wed 18 Jul 2018 12:44:17 AM UTC, comment #11: 

Oops, bad cut and paste.  Try this new diff.

I didn't test the configure script.  I just tested the individual program, on x86_64 and Michele's solaris system.  I tried with the system BLAS (4-byte integers) and a separate ddot.f file that was compiled with -fdefault-integer-8.

(file #44576)

John W. Eaton <jwe>
Group administrator
Wed 18 Jul 2018 12:28:18 AM UTC, comment #10: 

Hmm, I get configure exiting with an error on x86_64, as well as mips and s390x, all with the same error.


checking whether LSAME is called correctly from Fortran... yes
checking whether ISAMAX is called correctly from Fortran... yes
checking whether SDOT is called correctly from Fortran... yes
checking whether DDOT is called correctly from Fortran... yes
checking whether CDOTU is called correctly from Fortran... yes
checking whether ZDOTU is called correctly from Fortran... 4
./configure: line 30452: test: too many arguments
checking for sgemm_ in -lblas... yes
checking whether LSAME is called correctly from Fortran... yes
checking whether ISAMAX is called correctly from Fortran... yes
checking whether SDOT is called correctly from Fortran... no
checking whether DDOT is called correctly from Fortran... yes
checking whether CDOTU is called correctly from Fortran... no
checking whether ZDOTU is called correctly from Fortran... 4
./configure: line 32220: test: too many arguments
configure: error: BLAS and LAPACK libraries are required


I haven't looked at the patch to see if this is a simple mistake, but it seems like a shell variable substitution error rather than a logic error in the change to the test program itself.

Mike Miller <mtmiller>
Group Member
Wed 18 Jul 2018 12:04:15 AM UTC, comment #9: 

If it works, I'll build another tarball for Michele to test back on the Solaris bug report.

Rik <rik5>
Group administrator
Tue 17 Jul 2018 11:25:15 PM UTC, comment #8: 

I will test this on my Debian mips and s390x emulators for confirmation, may take a little while.

Mike Miller <mtmiller>
Group Member
Tue 17 Jul 2018 11:18:33 PM UTC, comment #7: 

I came up with the attached test program that I think should work on either big- or little-endian systems.  Seems to work with my tests.



(file #44575)

John W. Eaton <jwe>
Group administrator
Tue 17 Jul 2018 08:15:53 PM UTC, comment #6: 

Is there a way to use existing Autoconf macros to help change the test for integer size?

I see AC_C_BIGENDIAN which could be used to determine the endianness of the system.  Maybe then one uses


dnl
dnl Check if the default Fortran INTEGER is 64 bits wide.
dnl If cross-compiling, assume 4 bytes unless the cache value
dnl is already set.
dnl
AC_DEFUN([OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER], [
  AC_CACHE_CHECK([default size of Fortran INTEGER],
    [octave_cv_sizeof_fortran_integer],
    [ac_octave_save_FFLAGS="$FFLAGS"
     FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
     AC_LANG_PUSH(Fortran 77)

     if test -z "$WORDS_BIGENDIAN"; then
       AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
      integer*8 n8
      integer n
c Generate -2**33 + 1.
      n8 = 2
      n8 = -4 * (n8 ** 30)
      n8 = n8 + 1
c Convert to default integer type.  If the values are no longer equal,
c assume the default integer size is 32-bits.
      n = n8
      if (n .ne. n8) stop 1
         ]])],
         octave_cv_sizeof_fortran_integer=8,
         octave_cv_sizeof_fortran_integer=4,
         octave_cv_sizeof_fortran_integer=4)
     else
       AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
c *** program that works on a big endian system ***
         ]])],
         octave_cv_sizeof_fortran_integer=8,
         octave_cv_sizeof_fortran_integer=4,
         octave_cv_sizeof_fortran_integer=4)
     fi

     AC_LANG_POP(Fortran 77)
     FFLAGS="$ac_octave_save_FFLAGS"
  ])
])


Just trying to move the ball forward on this bug.

Rik <rik5>
Group administrator
Tue 15 May 2018 11:24:47 PM UTC, comment #5: 

Sorry, I don't have access to give, but I can probably test any potential fixes.

Mike Miller <mtmiller>
Group Member
Tue 15 May 2018 08:25:58 PM UTC, comment #4: 

Could anyone provide access to a big-endian system so I could use to do some testing?

John W. Eaton <jwe>
Group administrator
Tue 08 May 2018 06:50:38 AM UTC, comment #3: 

I patched the Debian source package to set the integer size to be 4 bytes unconditionally until we can resolve this here.

https://salsa.debian.org/pkg-octave-team/octave/blob/e4b807459a80edfa3f6c4780cf0504ea26d3564d/debian/patches/assume-blas-integer-size.patch

I don't have any bright ideas about fixing this properly at the moment.

Mike Miller <mtmiller>
Group Member
Sun 06 May 2018 07:12:12 PM UTC, comment #2: 

After looking at the test program, it's pretty clear that it's expecting a 8 byte integer on the stack to be interpreted by only looking at the least-significant 4 bytes. On a big endian system, the argument is interpreted as -1 (from the most-significant 4 bytes) instead of +1. That's why the test then wrongly thinks that the integer size is 8 bytes. Needs some rethinking to fix this properly.

Mike Miller <mtmiller>
Group Member
Sun 06 May 2018 06:35:22 PM UTC, comment #1: 

If I can't figure out the cause of this in the next days, I am planning on patching the configure script to always use ax_blas_integer_size=4 in the Debian source package, since we know Debian Fortran libraries are always built with gfortran with the default 32-bit integer size.

Mike Miller <mtmiller>
Group Member
Sun 06 May 2018 06:30:11 PM UTC, original submission:  

The new logic in Octave 4.4 to try to determine the BLAS integer parameter size fails on big endian systems. The integer size is determined to be 8 bytes, even though the true integer size is 4 bytes.

With Octave 4.2 on Debian GNU/Linux mips:


checking whether the integer size is correct... yes


With Octave 4.4 on Debian GNU/Linux mips:


checking BLAS library integer size... 8

checking default size of Fortran INTEGER... 4
configure: adding -fdefault-integer-8 to F77_INTEGER_8_FLAG
checking default size of Fortran INTEGER... 8



Mike Miller <mtmiller>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44576:  diffs.txt added by jwe (2KiB - text/plain)
file #44575:  diffs.txt added by jwe (3KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-10 siko1056 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2018-08-06 siko1056 Attached File- Added bug53853-unnecessay-else.patch, #44730
    2018-08-06 siko1056 StatusFixed Ready For Test
        Open/ClosedClosed Open
        Releasedev 4.4.1-rc2
    2018-07-18 mtmiller StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2018-07-18 jwe StatusConfirmed Ready For Test
    2018-07-18 jwe Attached File- Added diffs.txt, #44576
    2018-07-17 jwe Attached File- Added diffs.txt, #44575
    2018-05-06 mtmiller StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code