Problem with the implicit module finding system used for the packages on github.
I have a problem with one (three, actually) of the APEX unit tests. If the following code fragment is compiled as a SaC module, with -doinl, the function testthornXIB (marked as "inline" in its header, btw) it dies in execution. With -noinl, it works properly.
crud.sac UTThornBoolean.unittest.sac
First, we generate a module from crud.sac, AND make the module name crud:
ls
crud.sac UTThornBoolean.NOTME.sac UTThornBoolean.unittest.sac
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ grep MODNM *.sac
crud.sac:module MODNM;
UTThornBoolean.unittest.sac:use MODNM: all;
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c crud.sac -maxoptcyc 2 -DMODNM=crud
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c UTThornBoolean.unittest.sac -maxoptcyc 2 -DMODNM=crud -doinl
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ a.out
Dimension: 1
Shape : < 1>
< 1 >
Dimension: 1
Shape : < 1>
< 1 >
Dimension: 1
Shape : < 2>
< 1 1 >
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c UTThornBoolean.unittest.sac -maxoptcyc 2 -DMODNM=crud -noinl
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ a.out
Dimension: 1
Shape : < 1>
< 1 >
Dimension: 1
Shape : < 1>
< 1 >
Dimension: 1
Shape : < 2>
< 1 1 >
So far, so good. Now, we use a different module name:
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ rm -r a.out* tree/ host/
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c crud.sac -maxoptcyc 2 -DMODNM=notcrud
warning: Module/class 'notcrud` should be in a file named "notcrud.sac" instead of "crud.sac"
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c UTThornBoolean.unittest.sac -maxoptcyc 2 -DMODNM=notcrud -noinl
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ a.out
Dimension: 1
Shape : < 1>
< 1 >
Dimension: 1
Shape : < 1>
< 1 >
Dimension: 1
Shape : < 2>
< 1 1 >
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c UTThornBoolean.unittest.sac -maxoptcyc 2 -DMODNM=notcrud -doinl
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ a.out
Dimension: 1
Shape : < 1>
< 1 >
Dimension: 1
Shape : < 1>
< 1 >
Dimension: 1
Shape : < 2>
< 1 1 >
Still good. The module Warning appears harmless. Let's try again with yet another module name:
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ rm -r a.out* tree/ host/
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c crud.sac -maxoptcyc 2 -DMODNM=UTThornBoolean
warning: Module/class 'UTThornBoolean` should be in a file named "UTThornBoolean.sac" instead of "crud.sac"
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c UTThornBoolean.unittest.sac -maxoptcyc 2 -DMODNM=UTThornBoolean -doinl
a.out
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ a.out
*** SAC runtime error
*** No appropriate instance of function "UTThornBoolean::matchresultsCCB :: Terminal::Terminal TermFile::TermFile char[*] char[*] int[*] int[*] int[*] -> Terminal::Terminal TermFile::TermFile bool " found!
*** Shape of arguments:
*** []
*** []
*** [ 5]
*** []
*** []
*** []
*** []
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ sac2c UTThornBoolean.unittest.sac -maxoptcyc 2 -DMODNM=UTThornBoolean -noinl
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3$ a.out
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0
This is strange in two ways:
-
Using -doinl causes the runtime to crash.
-
Using -noinl causes the code to execute, BUT it is not the code in the function in crud.sac.
So, it appears that we are pulling .so files from somewhere other than this folder. Where?
System call:
/usr/bin/cc -I. -I/usr/local/include/sac2c/1.3.3-MijasCosta-705-g41ed2/debug -DSAC_TARGET_STRING=\"default_sbi\" -DSAC_MODEXT_STRING=\".so\"
-DSAC_TARGET_ENV_STRING=\"host\" -DSAC_SBI_STRING=\"seq\" -DSAC_RC_METHOD=SAC_RCM_local -DSAC_BACKEND_C99 -DSAC_MT_LIB_ -DSAC_MT_MODE=0
-DSAC_DO_RTSPEC=0 -DSAC_DO_CUDA_ALLOC=SAC_CA_system -DSAC_DO_CUDA_SYNC=1 -march=native -mtune=native -pedantic -g -fPIC
-D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
-Wno-unused-but-set-variable -Wno-unused-function -Wno-strict-overflow -Wimplicit-fallthrough=3 -Wno-format-truncation -pedantic -std=gnu99
-pedantic -Wno-unused -fno-builtin -E -o /primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3/a.out.i
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3/a.out.c
Compiling C source "a.out.i"
System call:
/usr/bin/cc -march=native -mtune=native -pedantic -g -fPIC -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -Wall
-Wextra -Wstrict-prototypes -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-function -Wno-strict-overflow
-Wimplicit-fallthrough=3 -Wno-format-truncation -pedantic -std=gnu99 -pedantic -Wno-unused -fno-builtin -c -o /tmp/SAC_571EIv/a.out.o
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3/a.out.i
Linking "a.out"
System call:
/usr/bin/cc /tmp/SAC_571EIv/a.out.o -Wl,-allow-shlib-undefined -L/usr/local/lib/sac2c/1.3.3-MijasCosta-705-g41ed2/modlibs/host/seq
-Wl,-rpath,/usr/local/lib/sac2c/1.3.3-MijasCosta-705-g41ed2/modlibs/host/seq
-L/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/build/lib/host/seq
-Wl,-rpath,/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/build/lib/host/seq
-L/usr/local/lib/sac2c/1.3.3-MijasCosta-705-g41ed2/modlibs/host/seq -Wl,-rpath,/usr/local/lib/sac2c/1.3.3-MijasCosta-705-g41ed2/modlibs/host/seq
-L/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/build/lib/host/seq
-Wl,-rpath,/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/build/lib/host/seq
-L/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3/host/seq
-Wl,-rpath,/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3/host/seq
-L/usr/local/lib/sac2c/1.3.3-MijasCosta-705-g41ed2/rt/host/seq -Wl,-rpath,/usr/local/lib/sac2c/1.3.3-MijasCosta-705-g41ed2/rt/host/seq
-lwhasisMod -lStdIOMod -lBinFileMod -lFibreIOMod -lListIOMod -lComplexIOMod -lColor8IOMod -lGreyIOMod -lArrayIOMod -lScalarIOMod
-lStringArrayMod -lRuntimeErrorMod -lIOresourcesMod -lStructuresMod -lArrayFormatMod -lBitsMod -lComplexMod -lQuaternionMod -lListMod
-lColor8Mod -lGreyMod -lFileMod -lTermFileMod -lTerminalMod -lFileSystemMod -lArrayMod -lMathArrayMod -lComplexArrayTransformMod
-lArrayTransformMod -lComplexArrayArithMod -lSysErrMod -lWorldMod -lComplexScalarArithMod -lComplexArrayBasicsMod -lConstantsMod -lArrayArithMod
-lBoolMod -lComplexBasicsMod -lStringMod -lMathMod -lScalarArithMod -lCharMod -lArrayBasicsMod -lsacprelude_pMod -lsac_d -lsacphm_d -lm -o
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornBoolean/src/crud3/a.out