On 3/24/2022 6:22 PM, Jeremie Courreges-Anglas wrote:
> On Thu, Mar 24 2022, Brian Callahan <bcal...@posteo.net> wrote:
>> Hi Jeremie --
>>
>> On 3/24/2022 2:42 PM, Jeremie Courreges-Anglas wrote:
>>>
>>> algol68g fails to build on riscv64, with a nasty error.  BUILD_UNIX is
>>> not defined, resulting in a compile error in unix.c.
>>>
>>> I'm not sure why you explicitely added arm64 and armv7 but I see no
>>> reason to fix the build on some archs only.  FWIW the test results on
>>> riscv64 look good, 3 tests failing out of 23 (1 on amd64). The two
>>> additional tests that fail:
>>>
>>> --8<--
>>> a68g: runtime error: 1: time limit exceeded, in VOID loop-clause starting 
>>> at "TO" in line 114.
>>> FAIL: test-set/13-math.a68
>>> This test will take a long time ...
>>> [./test-set/14-mersenne.a68]
>>> 28    DO s := (s * s - 2) MOD cand
>>>                    1
>>> a68g: runtime error: 1: time limit exceeded, in LONG LONG INT closed-clause 
>>> starting at "(" in this line.
>>> FAIL: test-set/14-mersenne.a68
>>> -->8--
>>>
>>>
>>> ok?
>>>
>>>
>>> Index: patches/patch-configure_ac
>>> ===================================================================
>>> RCS file: /cvs/ports/lang/algol68g/patches/patch-configure_ac,v
>>> retrieving revision 1.2
>>> diff -u -p -r1.2 patch-configure_ac
>>> --- patches/patch-configure_ac      13 Mar 2022 21:03:42 -0000      1.2
>>> +++ patches/patch-configure_ac      24 Mar 2022 09:06:28 -0000
>>> @@ -1,4 +1,4 @@
>>> -Enable build on arm64 and armv7
>>> +Enable build on all archs
>>>  Build the compiler
>>>  Mention that we are IEEE 754 compliant
>>>  Remove hardcoded optimization flags
>>> @@ -12,7 +12,7 @@ Index: configure.ac
>>>   # OpenBSD.
>>>   #
>>>  -*86-*-openbsd* | *86_64-*-openbsd*) 
>>> -+*86-*-openbsd* | *86_64-*-openbsd* | arm*-*-openbsd* | aarch*-*-openbsd*) 
>>> ++*-*-openbsd*)
>>>     AC_DEFINE(BUILD_BSD, 1, [Define this if OpenBSD was detected]) 
>>>  -  AC_MSG_WARN([configuring interpreter-only])
>>>  +  AC_DEFINE(HAVE_IEEE_754, 1, [Define this if IEEE_754 compliant]) 
>>>
>>>
>>
>> It was set this way because everyone was under the impression the
>> compiler only worked in x86 and arm. If it works universally, go for it.
> 
> riscv64 is LP64 little-endian, like x86, armv7 and arm64.  The build
> fails on sparc64 because base-gcc uses -std=gnu89 by default:
> 
> --8<--
> ===>  Building for algol68g-3.0.4
> make  all-am
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-sounds.o -MD -MP -MF ./src/a68g/.deps/a68g-sounds.Tpo -c -o 
> ./src/a68g/a68g-sounds.o `test -f
> './src/a68g/sounds.c' || echo './'`./src/a68g/sounds.c
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-taxes.o -MD -MP -MF ./src/a68g/.deps/a68g-taxes.Tpo -c -o 
> ./src/a68g/a68g-taxes.o `test -f './
> src/a68g/taxes.c' || echo './'`./src/a68g/taxes.c
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-top-down.o -MD -MP -MF ./src/a68g/.deps/a68g-top-down.Tpo -c 
> -o ./src/a68g/a68g-top-down.o `te
> st -f './src/a68g/top-down.c' || echo './'`./src/a68g/top-down.c
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-torrix.o -MD -MP -MF ./src/a68g/.deps/a68g-torrix.Tpo -c -o 
> ./src/a68g/a68g-torrix.o `test -f
> './src/a68g/torrix.c' || echo './'`./src/a68g/torrix.c
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-transput.o -MD -MP -MF ./src/a68g/.deps/a68g-transput.Tpo -c 
> -o ./src/a68g/a68g-transput.o `te
> st -f './src/a68g/transput.c' || echo './'`./src/a68g/transput.c
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-unix.o -MD -MP -MF ./src/a68g/.deps/a68g-unix.Tpo -c -o 
> ./src/a68g/a68g-unix.o `test -f './src
> /a68g/unix.c' || echo './'`./src/a68g/unix.c
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-victal.o -MD -MP -MF ./src/a68g/.deps/a68g-victal.Tpo -c -o 
> ./src/a68g/a68g-victal.o `test -f
> './src/a68g/victal.c' || echo './'`./src/a68g/victal.c
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-socket.o -MD -MP -MF ./src/a68g/.deps/a68g-socket.Tpo -c -o 
> ./src/a68g/a68g-socket.o `test -f
> './src/a68g/socket.c' || echo './'`./src/a68g/socket.c
> In file included from ./src/a68g/unix.c:25:
> ./src/include/a68g-mp.h: In function 'len_mp':
> ./src/include/a68g-mp.h:142: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h:145: error: redefinition of 'k'
> ./src/include/a68g-mp.h:142: error: previous definition of 'k' was here
> ./src/include/a68g-mp.h:145: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h: In function 'cut_mp':
> ./src/include/a68g-mp.h:164: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h:172: warning: declaration of 'k' shadows a previous 
> local
> ./src/include/a68g-mp.h:164: warning: shadowed declaration is here
> ./src/include/a68g-mp.h:172: error: 'for' loop initial declaration used 
> outside C99 mode
> mv -f ./src/a68g/.deps/a68g-torrix.Tpo ./src/a68g/.deps/a68g-torrix.Po
> cc -DHAVE_CONFIG_H -I.  -I./src/include -I/usr/local/include 
> -DBINDIR='"/usr/local/bin"' -DINCLUDEDIR='"/usr/local/include/algol68g"' -O2 
> -pipe -Wshadow -Wunused-variable -Wunused-parameter -Wno-long-long -MT 
> ./src/a68g/a68g-single-rnd.o -MD -MP -MF ./src/a68g/.deps/a68g-single-rnd.Tpo 
> -c -o ./src/a68g/a68g-single-rnd
> .o `test -f './src/a68g/single-rnd.c' || echo './'`./src/a68g/single-rnd.c
> In file included from ./src/a68g/sounds.c:25:
> ./src/include/a68g-mp.h: In function 'len_mp':
> ./src/include/a68g-mp.h:142: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h:145: error: redefinition of 'k'
> ./src/include/a68g-mp.h:142: error: previous definition of 'k' was here
> ./src/include/a68g-mp.h:145: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h: In function 'cut_mp':
> ./src/include/a68g-mp.h:164: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h:172: warning: declaration of 'k' shadows a previous 
> local
> ./src/include/a68g-mp.h:164: warning: shadowed declaration is here
> ./src/include/a68g-mp.h:172: error: 'for' loop initial declaration used 
> outside C99 mode
> In file included from ./src/a68g/transput.c:25:
> ./src/include/a68g-mp.h: In function 'len_mp':
> ./src/include/a68g-mp.h:142: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h:145: error: redefinition of 'k'
> ./src/include/a68g-mp.h:142: error: previous definition of 'k' was here
> ./src/include/a68g-mp.h:145: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h: In function 'cut_mp':
> ./src/include/a68g-mp.h:164: error: 'for' loop initial declaration used 
> outside C99 mode
> ./src/include/a68g-mp.h:172: warning: declaration of 'k' shadows a previous 
> local
> ./src/include/a68g-mp.h:164: warning: shadowed declaration is here
> ./src/include/a68g-mp.h:172: error: 'for' loop initial declaration used 
> outside C99 mode
> -->8--
> 
> Fixing that by adding -std=gnu99 results in broken tests (all of them).
> gdb backtrace with DEBUG=-g:
> --8<--
> #0  0x000000075c7a0ef4 in add_option_list (l=0x75cb5ff38, 
> str=0xfffffffffffdcd2f "./test-set/23-whetstones.a68", line=0x0) at 
> ./src/a68g/options.c:213
> 213         SCAN (*l) = SOURCE_SCAN (&A68_JOB);
> (gdb) bt
> #0  0x000000075c7a0ef4 in add_option_list (l=0x75cb5ff38, 
> str=0xfffffffffffdcd2f "./test-set/23-whetstones.a68", line=0x0) at 
> ./src/a68g/options.c:213
> #1  0x000000075c701728 in main (argc=0, argv=0xfffffffffffdcb48) at 
> ./src/a68g/a68g.c:731
> -->8--
> 
> The code before line 213:
> --8<--
> void add_option_list (OPTION_LIST_T ** l, char *str, LINE_T * line)
> {
>   if (*l == NO_OPTION_LIST) {
>     *l = (OPTION_LIST_T *) get_heap_space ((size_t) SIZE_ALIGNED 
> (OPTION_LIST_T));
>     SCAN (*l) = SOURCE_SCAN (&A68_JOB);
> -->8--
> looks inscrutable to me. Maybe a strict alignement issue, maybe not.
> Using the diff below, makepackage and make test pass on sparc64 like
> they do on riscv64, including the time limit exceeded issue:
> --8<--
> 3 of 23 tests failed
> Please report to Marcel van der Veer <algol...@xs4all.nl>
> -->8--
> 
> Updated diff that makes use of ports-gcc on sparc64 and friends, still
> fine with it?
> 

Yes, thanks. I will push this to upstream as well.

~Brian

Reply via email to