array lengths not known at compile time

Tim Rice
Sun, 24 Jan 2021 20:57:04 -0000

I've been building OpenSSH on UnixWare 7 using the native compiler
for a long time. I pulled the latest source yesterday and got this error.
.......
cc -g   -I. -I/opt/src/networking/openssh/openssh -I/opt/include
-Dvsnprintf=_xvsnprintf -Dsnprintf=_xsnprintf -DSSHDIR=\"/etc/ssh\"
-D_PATH_SSH_PROGRAM=\"/opt/bin/ssh\"
-D_PATH_SSH_ASKPASS_DEFAULT=\"/opt/libexec/ssh-askpass\"
-D_PATH_SFTP_SERVER=\"/opt/libexec/sftp-server\"
-D_PATH_SSH_KEY_SIGN=\"/opt/libexec/ssh-keysign\"
-D_PATH_SSH_PKCS11_HELPER=\"/opt/libexec/ssh-pkcs11-helper\"
-D_PATH_SSH_SK_HELPER=\"/opt/libexec/ssh-sk-helper\"
-D_PATH_SSH_PIDDIR=\"/var/run\"
-D_PATH_PRIVSEP_CHROOT_DIR=\"/var/empty/sshd\" -DHAVE_CONFIG_H -c
/opt/src/networking/openssh/openssh/sntrup761.c -o sntrup761.o
UX:acomp: ERROR: "/opt/src/networking/openssh/openssh/sntrup761.c",
line 298: integral constant expression expected
UX:acomp: ERROR: "/opt/src/networking/openssh/openssh/sntrup761.c",
line 299: integral constant expression expected
UX:acomp: ERROR: "/opt/src/networking/openssh/openssh/sntrup761.c",
line 300: integral constant expression expected
UX:acomp: ERROR: "/opt/src/networking/openssh/openssh/sntrup761.c",
line 301: integral constant expression expected
UX:acomp: ERROR: "/opt/src/networking/openssh/openssh/sntrup761.c",
line 364: integral constant expression expected
UX:acomp: ERROR: "/opt/src/networking/openssh/openssh/sntrup761.c",
line 365: integral constant expression expected
UX:acomp: ERROR: "/opt/src/networking/openssh/openssh/sntrup761.c",
line 686: integral constant expression expected
gmake: *** [sntrup761.o] Error 1
.......

In the source we see lines like this
uint16 R2[(len+1)/2];
uint16 M2[(len+1)/2];
uint16 bottomr[len/2];
uint32 bottomt[len/2];

UnixWare's USL compiler doesn't know what to do when "len" is
not known
at compile time.

I know how to "fix" this but as this is 2021 and UnixWare 7D2M1
has a GCC 7.3.0 available, I'm not sure it is worth the effort.
It may be time to drop support for old crufty compilers.

The question in my mind is, are UnixWare (and Openserver 6) the only
platforms that will be tripped up on this? If so, I'll just start
building with GCC.

But what about IRIX, HP-UX, SGI, Tru64?
I'm guessing they updated their compilers long ago but I do not know.

Anyone know?

Thanks for reading.

--
Tim Rice				Multitalents
tim at multitalents.net