sac2c issueshttps://gitlab.sac-home.org/sac-group/sac2c/-/issues2022-02-26T11:48:17Zhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2299"Module not found" error message is too verbose2022-02-26T11:48:17ZRobert Bernecky"Module not found" error message is too verboseIf you run sac2c with a stale Stdlib, you get this sort of output, which is
not exactly user friendly:
```
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTShape/src$ sac2c UTShape.sac
./UTShape.sac:5:10: error:
=> cannot load mo...If you run sac2c with a stale Stdlib, you get this sort of output, which is
not exactly user friendly:
```
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTShape/src$ sac2c UTShape.sac
./UTShape.sac:5:10: error:
=> cannot load module `Array'
error: module `Array' not cached
./UTShape.sac:7:9: error:
=> cannot load module `Bits'
error: module `Bits' not cached
./UTShape.sac:9:16: error:
=> cannot load module `CommandLine'
error: module `CommandLine' not cached
./UTShape.sac:11:12: error:
=> cannot load module `RTClock'
error: module `RTClock' not cached
./UTShape.sac:13:11: error:
=> cannot load module `String'
OOOOOOOPS, your program crashed the compiler 8-((
Please, submit the bug report online at
https://gitlab.sac-home.org/sac-group/sac2c/-/issues.
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2296make rebuild_cache seems not to copy over new sub-directories in the tests di...2022-02-18T09:28:11ZSven-Bodo Scholzmake rebuild_cache seems not to copy over new sub-directories in the tests directoryTitle says it all..Title says it all..https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2293Several crashes with -maxoptcyc N, where N is 0 1 or 22022-02-11T19:03:01ZRobert BerneckySeveral crashes with -maxoptcyc N, where N is 0 1 or 2I got tired of waiting for sac2c to get its thumb out, so decided to short-circuit
the optimizations. What happens next is shown below. I will look at this issue again
when I get some other problems fixed in UTThornInt.sac.
[UTThornInt....I got tired of waiting for sac2c to get its thumb out, so decided to short-circuit
the optimizations. What happens next is shown below. I will look at this issue again
when I get some other problems fixed in UTThornInt.sac.
[UTThornInt.sac](/uploads/24c12dd9d50ac2164f9f644fb10ff6a2/UTThornInt.sac)
```
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c UTThornInt.sac -maxoptcyc 0
free(): invalid next size (fast)
Aborted (core dumped)
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c UTThornInt.sac -maxoptcyc 1
free(): invalid next size (fast)
Aborted (core dumped)
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c UTThornInt.sac -maxoptcyc 2
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud/a.out.c: In function ‘SACf__MAIN_CLArrayFormat__format__i_1’:
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud/a.out.c:47950:369: error: ‘SACp_emal_65927__pinl_60713__flat_49__SSA50_1__shpSAC_d’ undeclared (first use in this function); did you mean ‘SACp_emal_65927__pinl_60713__flat_49__SSA50_1__shp0’?
47950 | SAC_AUD_WL_BEGIN((SACp_pinl_63461_iv, (AKD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACp_pinl_63466__wlidx_61383_res, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACp_emal_65927__pinl_60713__flat_49__SSA50_1, (AKS, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))))
| ^
| SACp_emal_65927__pinl_60713__flat_49__SSA50_1__shp0
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud/a.out.c:47950:369: note: each undeclared identifier is reported only once for each function it appears in
abort: System failed to execute shell command
abort: /usr/bin/cc -O3 -march=native -mtune=native -pedantic -g -fPIC -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE -D_SVID_SOURCE
abort: -D_BSD_SOURCE -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-function
abort: -Wno-strict-overflow -Wimplicit-fallthrough=3 -Wno-format-truncation -pedantic -std=gnu99 -pedantic -Wno-unused -fno-builtin
abort: -c -o /tmp/SAC_mnVRuG/a.out.o /primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud/a.out.i
abort: with exit code 1
compilation failed while Creating binary code.
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c UTThornInt.sac -maxoptcyc 3
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ a.out
got to A_69
got past A_69
got to A_74
got past A_74
got to A_82
got past A_82
got to A_92
got past A_92
1 1 1 1
1 1 1 1
0
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c -V
sac2c 1.3.3-MijasCosta-748-ga0acb
build-type: RELEASE
built-by: "sac" at 2022-02-10T10:30:52
```
With -maxoptcyc 3, the code executes properly.
With the debug compiler, things are slightly different:
```
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c_d UTThornInt.sac -maxoptcyc 0 -v1
error: line 152 in file /home/sac/sac/BASE/Stdlib/src/structures/ArrayBasics.xsac:
error: argument #1 of "_idx_sel_" should be legal offset index into argument #2; types found: int{0} and int[0]
compilation failed while Running SAC optimizations.
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c_d UTThornInt.sac -maxoptcyc 1 -v1
error: line 152 in file /home/sac/sac/BASE/Stdlib/src/structures/ArrayBasics.xsac:
error: argument #1 of "_idx_sel_" should be legal offset index into argument #2; types found: int{0} and int[0]
compilation failed while Running SAC optimizations.
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c_d UTThornInt.sac -maxoptcyc 2 -v1
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud/a.out.c: In function ‘SACf__MAIN_CLArrayFormat__format__i_1’:
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud/a.out.c:47950:369: error: ‘SACp_emal_65927__pinl_60713__flat_49__SSA50_1__shpSAC_d’ undeclared (first use in this function); did you mean ‘SACp_emal_65927__pinl_60713__flat_49__SSA50_1__shp0’?
47950 | SAC_AUD_WL_BEGIN((SACp_pinl_63461_iv, (AKD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACp_pinl_63466__wlidx_61383_res, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACp_emal_65927__pinl_60713__flat_49__SSA50_1, (AKS, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))))
| ^
| SACp_emal_65927__pinl_60713__flat_49__SSA50_1__shp0
/primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud/a.out.c:47950:369: note: each undeclared identifier is reported only once for each function it appears in
abort: System failed to execute shell command
abort: /usr/bin/cc -march=native -mtune=native -pedantic -g -fPIC -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE -D_SVID_SOURCE
abort: -D_BSD_SOURCE -Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-function
abort: -Wno-strict-overflow -Wimplicit-fallthrough=3 -Wno-format-truncation -pedantic -std=gnu99 -pedantic -Wno-unused -fno-builtin
abort: -c -o /tmp/SAC_v3FTj9/a.out.o /primarypool/dshome/apex/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud/a.out.i
abort: with exit code 1
compilation failed while Creating binary code.
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c_d UTThornInt.sac -maxoptcyc 3 -v1
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ a.out
got to A_69
got past A_69
got to A_74
got past A_74
got to A_82
got past A_82
got to A_92
got past A_92
1 1 1 1
1 1 1 1
0
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$
apex@medusa:~/apexgit/Ancillary/benchmks/UnitTests/UTThornInt/src/crud$ sac2c_d -V
sac2c 1.3.3-MijasCosta-748-ga0acb
build-type: DEBUG
built-by: "sac" at 2022-02-10T10:28:29
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2281inlinining/ dispatch problem2022-01-17T16:05:15ZSven-Bodo Scholzinlinining/ dispatch problemThis is related to issue #2278 in the sense that this bug triggered the observation of #2278.
We have a module `UTThornBoolean.sac` which is used by `UTThornBoolean.unittest.sac`.
This code is a unit test for code generated by the APEX ...This is related to issue #2278 in the sense that this bug triggered the observation of #2278.
We have a module `UTThornBoolean.sac` which is used by `UTThornBoolean.unittest.sac`.
This code is a unit test for code generated by the APEX compiler's SaC
array formatting functions, in this particular case operating on Boolean arrays.
(A similar failure to that presented here occurs with integer and double arrays.)
Executing
```
sac2c UTThornBoolean.sac
sac2c UTThornBoolean.unittest.sac
./a.out
```
yields the correct result:
```
Dimension: 1
Shape : < 5>
<0 1 0>
```
When using -DERROR on the first sac2c call, we erroneously obtain
```Dimension: 0
Shape : <>
0
```
The problem seems related to the dispatch of the format function and the view of format within UTThornBoolean.
The failure appears to be related to SaC modules, and is sensitive to code inlining. Specifically,
-noinl (on the sac2c command line) or at function headers within the executed code), or execution
outside of modules, changed the failure and/or allowed the code to run correctly.
BTW, fault isolation for these types of failures is protracted, due in part to the slow execution
of the sac2c compiler on any non-trivial source code. If recompiling the Stblib is part of
the fault-isolation show, this can be extremely frustrating for those of us with uncomfortable chairs.
The specific fault appears to lie in the wrapper functions generated by sac2c. The job
of the wrapper functions is to dispatch (call) the proper version of a function, based
on the characteristics of the function argument and its parameters. In this case,
the argument to Stdlib's ArrayFormat::format( X) had an argument X of type "bool[3]",
but the dispatched version of format() required an argument X of type "bool", a scalar.
Moving format() into the apex-generated code caused the unit test to work properly, because
the dispatch code had been optimized away by sac2c. We have been unable to recreate the failure
without using a call tree of the form:
```
main() --> localModule() --> StdlibModule::format()
```
[UTThornBoolean.sac](/uploads/c1129cfc809275c9e4dfcf43c1c184cf/UTThornBoolean.sac)[UTThornBoolean.unittest.sac](/uploads/3a7a7c3fd4a416bf2363b76a7dbec8af/UTThornBoolean.unittest.sac)https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2279Painfully slow Stdlib build needs fixing2022-01-21T13:43:38ZRobert BerneckyPainfully slow Stdlib build needs fixingOnce upon a time, there was a unit test bug that caused me grief:
> . Some time ago, those apex unit tests (#2278) ran clean. They no longer do so.
> I was going to use our dear friend, git bisect, to see if I can determine when th...Once upon a time, there was a unit test bug that caused me grief:
> . Some time ago, those apex unit tests (#2278) ran clean. They no longer do so.
> I was going to use our dear friend, git bisect, to see if I can determine when that
> unit test code ceased to work.
>
> However, the fact that it can take 45 minutes to compile the Stdlib makes use of
> this tool utterly impractical, unless you can come up with a failing example that
> does not require Stdlib. The work required to develop said failing example can take
> days or weeks. This is NOT a good use of our time and energy.
>
> The critical path in a Stdlib build is, based on observation while waiting for things
> to complete, long, much like a strand of spaghetti. We could get, I think, a
> factor of two speedup by building all targets concurrently (e.g., seq and mt_pth).
> I don't have any other bright ideas. Or other kinds.
I think the seq/mt_pth change "should" be simple, but there is presumably something
that makes it non-simple.https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2278Problem with the implicit module finding system used for the packages on github.2022-01-12T19:44:07ZRobert BerneckyProblem 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 -no...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](/uploads/c62fd890cec399eb69a0cbb36fdfdaa2/crud.sac)
[UTThornBoolean.unittest.sac](/uploads/d37949dc3dad8bac3fb00df446962fba/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:
1. Using -doinl causes the runtime to crash.
2. 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
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2273Create a release2021-09-01T11:27:03ZHans-Nikolai ViessmannCreate a releaseIts been a while since we released a 'stable' version of sac2c. I don't see any reason to delay this, I think the compiler is pretty stable at the moment (seq, mt-pth, cuda targets seems to work fine).
Before we do this though, I think ...Its been a while since we released a 'stable' version of sac2c. I don't see any reason to delay this, I think the compiler is pretty stable at the moment (seq, mt-pth, cuda targets seems to work fine).
Before we do this though, I think there are a few things we should consider:
- [ ] what do we name it? _There hasn't been a devcamp in a while, so I guess we're going to have to get creative here..._
- [ ] decide on some schedule, or conditions to help us get into the habit of making releases more regularly (last stable release is 1.3.3-MijasCosta)
- [ ] in https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2269#note_10870, @rbe makes a really good point regarding actually documenting the changes in the compiler (especially new features!). This would help making it more clear how much work is going into the compiler, and what research activities this is driving. For example, we have two presentations at IFL2021 talking about new features that are in the pipeline to be merged in a some point. I think adding a CHANGELOG file to the repo, and as part of a MR filling it in would go a long way. The changelog might also help in figuring out when to make a release (major or minor).
I probably missed out some things to consider, suggestions are welcome!!!Create a releaseHans-Nikolai ViessmannHans-Nikolai Viessmannhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2272valgrind value errors detected in sac2c WLIR, PH, TRAVdo...2021-08-29T16:32:12ZRobert Berneckyvalgrind value errors detected in sac2c WLIR, PH, TRAVdo...Holden and I are trying to find out why sac2c runs several orders of magnitude slower than it should.
Our APEX CI tests can't even run the APEX UnitTests in an hour!
I stumbled on this just now, while hoping to find some directions fro...Holden and I are trying to find out why sac2c runs several orders of magnitude slower than it should.
Our APEX CI tests can't even run the APEX UnitTests in an hour!
I stumbled on this just now, while hoping to find some directions from valgrind:
```
Sun 22 Aug 2021 11:41:14 AM EDT
apex@boa:~/apexgit/Ancillary/benchmks/UnitTests/UTTakeDrop/src$ valgrind sac2c UTTakeDrop.sac
==13174== Memcheck, a memory error detector
==13174== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==13174== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==13174== Command: sac2c UTTakeDrop.sac
==13174==
==13174== Conditional jump or move depends on uninitialised value(s)
==13174== at 0x51E6D39: merge_dmask (withloop_invariant_removal.c:346)
==13174== by 0x51E6D39: WLIRassign (withloop_invariant_removal.c:779)
==13174== by 0x5213F3C: TRAVdo (traverse.c:97)
==13174== by 0x51E6BF9: WLIRblock (withloop_invariant_removal.c:650)
==13174== by 0x5213F3C: TRAVdo (traverse.c:97)
==13174== by 0x51E6AC3: WLIRfundef (withloop_invariant_removal.c:554)
==13174== by 0x5213F3C: TRAVdo (traverse.c:97)
==13174== by 0x51E7A7D: WLIRdoLoopInvariantRemoval (withloop_invariant_removal.c:1072)
==13174== by 0x51045EF: PHrunCyclePhaseFun (phase.c:588)
==13174== by 0x5104B71: PHDdriveCycleFun_cyc (phase_sac2c.mac:397)
==13174== by 0x5104382: PHrunCycleFun (phase.c:519)
==13174== by 0x5105694: PHDdriveCycle_cyc (phase_sac2c.mac:314)
==13174== by 0x5103C19: PHrunCycle (phase.c:332)
==13174==
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2268-mt compile dies in code generation: "linksign illegal"2021-07-03T05:13:25ZRobert Bernecky-mt compile dies in code generation: "linksign illegal"I do not recall observing this failure before. Is it new?
It fails with naked "make", too.
```
> [ 94%] Built target seq-prog-schedrAKD
> //home/apex/apexgit/Ancillary/benchmks/benchmksPerf/kroneckerproduct/src/kroneckerproduct.sac:17...I do not recall observing this failure before. Is it new?
It fails with naked "make", too.
```
> [ 94%] Built target seq-prog-schedrAKD
> //home/apex/apexgit/Ancillary/benchmks/benchmksPerf/kroneckerproduct/src/kroneckerproduct.sac:171:3: error:
> => Pragma 'linksign' illegal: mappings allowed exclusively between parameters with identical types
> compilation failed while Preparing C code generation, 1 error(s).
> make[2]: *** [kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-module-kroneckerproduct.dir/build.make:74: lib/host/mt-pth/libkroneckerproductMod.so] Error 129
> make[2]: Target 'kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-module-kroneckerproduct.dir/build' not remade because of errors.
> make[1]: *** [CMakeFiles/Makefile2:410: kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-module-kroneckerproduct.dir/all] Error 2
> //home/apex/apexgit/Ancillary/benchmks/benchmksPerf/kroneckerproduct/src/kroneckerproduct.sac:171:3: error:
> => Pragma 'linksign' illegal: mappings allowed exclusively between parameters with identical types
> compilation failed while Preparing C code generation, 1 error(s).
> make[2]: *** [kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-prog-kroneckerproduct.dir/build.make:78: lib/host/mt-pth/libkroneckerproductMod.so] Error 129
> make[2]: Target 'kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-prog-kroneckerproduct.dir/build' not remade because of errors.
> make[1]: *** [CMakeFiles/Makefile2:384: kroneckerproduct/src-mt_pth/CMakeFiles/mt_pth-prog-kroneckerproduct.dir/all] Error 2
> make[1]: Target 'all' not remade because of errors.
> make: *** [Makefile:136: all] Error 2
> make: Target 'default_target' not remade because of errors.
> apex@boa:~/apexgit/Ancillary/benchmks/benchmksPerf/build$
```
```
sac2c -V
sac2c 1.3.3-MijasCosta-677-g0587e
build-type: RELEASE
built-by: "sac" at 2021-06-23T15:20:00
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2267negative array shape crash in code generator2021-06-29T20:39:21ZRobert Berneckynegative array shape crash in code generator
```
sac2c_d snp3.codegencrash.sac -v1
Internal compiler error
Assertion "size >= 0" failed at /home/sac/sac2c.AprilFool/sac2c/src/libsac2c/codegen/icm2c_std.c:1250 -- array with size <0 found!
```
```
cat snp3.codegencrash.sac
use ...
```
sac2c_d snp3.codegencrash.sac -v1
Internal compiler error
Assertion "size >= 0" failed at /home/sac/sac2c.AprilFool/sac2c/src/libsac2c/codegen/icm2c_std.c:1250 -- array with size <0 found!
```
```
cat snp3.codegencrash.sac
use Array: {genarray,sum,shape,toi,sel,-,drop,==};
inline // ! ! ! must be inlined to fail
bool[.,.,.] jotdoteqIIB(int [.] x, int [.,.] y)
{ /* AxA outer product */
cell = genarray(shape(y), false);
z = with { (. <= iv <= .) { xitem = x[iv];
} : xitem == y;
} : genarray(shape(x), cell);
return(z);
}
int[.,.] plusslXBIFOLD(bool[.,.,.] y)
{ /* last axis reduce rank-2 or greater matrix w/folding */
zrho = [3,10000];
z = with { (. <= iv <= .)
: sum(toi(y[iv]));
} : genarray(zrho, 0);
return(z);
}
int main()
{
snp_0 = genarray([10000,80000], 2);
A_17=jotdoteqIIB([0, 1, 2],snp_0);
A_56=plusslXBIFOLD( A_17);
return(sum(A_56));
}
```
```
sac2c -V
sac2c 1.3.3-MijasCosta-677-g0587e
build-type: RELEASE
built-by: "sac" at 2021-06-23T15:20:00]
```Artem ShinkarovArtem Shinkarovhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2266Bad mt-pth code generation2022-11-20T12:08:54ZRobert BerneckyBad mt-pth code generationThis failure is in the apex Ancillary/benchmks/UnitTests/UTCatenate test, while running make.
```
[ 54%] Building UTCatenate.unittest.sac program for target `mt_pth'
[ 54%] Built target mt_pth-module-UTCatenate
/home/apex/apexgit/Ancil...This failure is in the apex Ancillary/benchmks/UnitTests/UTCatenate test, while running make.
```
[ 54%] Building UTCatenate.unittest.sac program for target `mt_pth'
[ 54%] Built target mt_pth-module-UTCatenate
/home/apex/apexgit/Ancillary/benchmks/UnitTests/build/UTCatenate-mt_pth.c: In function ‘SACf__MAIN_CL_ST___mtspmdf_53698_main__bl_26__bl__bl’:
/home/apex/apexgit/Ancillary/benchmks/UnitTests/build/UTCatenate-mt_pth.c:9558:89: warning: implicit declaration of function ‘NONE’ [-Wimplicit-function-declaration]
9558 | SAC_MT_SYNC_FOLD_out( SACf__MAIN_CL_ST___mtspmdf_53698_main__bl_26__bl__bl, 1, (SACp_emal_51959__pinl_22603__ea_47__flat_310, (SCL, (NHD, (NUQ, (INT, (GLO, (FPO, (NOT, (NDI, (BOO, )))))))))), (SACp_mtspmdfanon_53696__pinl_22603__ea_47__flat_310, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (BOO, )))))))))), bool, ND, NONE);
| ^~~~
/usr/bin/ld: /tmp/SAC_1RSJBE/UTCatenate-mt_pth.o: in function `SACf__MAIN_CL_ST___mtspmdf_53698_main__bl_26__bl__bl':
/home/apex/apexgit/Ancillary/benchmks/UnitTests/build/UTCatenate-mt_pth.c:9558: undefined reference to `NONE'
collect2: error: ld returned 1 exit status
abort: System failed to execute shell command
```
```
sac2c -V
sac2c 1.3.3-MijasCosta-667-g56d30
build-type: RELEASE
built-by: "sac" at 2021-05-26T16:16:09
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2262-dtreecheck bug2021-05-23T17:42:08ZSven-Bodo Scholz-dtreecheck bugThis issue has evolved from #2259 and #2261 which now both work without treecheck but fail through treecheck in phase 21:
```
** 21: Generating Code ...
**** Tag preparation ...
-> Running syntax tree checks
**** Creating...This issue has evolved from #2259 and #2261 which now both work without treecheck but fail through treecheck in phase 21:
```
** 21: Generating Code ...
**** Tag preparation ...
-> Running syntax tree checks
**** Creating intermediate code macros ...
-> Running syntax tree checks
warning: mandatory attribute ID_AVIS is NULL
...
warning: mandatory attribute ID_AVIS is NULL
OOOOOOOPS, your program crashed the compiler 8-((
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2253Parser being too smart with fold expressions2020-11-24T15:46:10ZArtem ShinkarovParser being too smart with fold expressions```sh
/tmp|=> cat test-fold.sac
```
```c
int main () {
a = [1,2,3];
return with {
([0] <= iv <= _shape_A_ (a)): _sel_VxA_ (iv, a);
}: fold (_add_SxS_, 0);
}
```
```sh
/tmp|=> ./sac2c/build_d/sac2c_d test-fold.sac
```
```
**...```sh
/tmp|=> cat test-fold.sac
```
```c
int main () {
a = [1,2,3];
return with {
([0] <= iv <= _shape_A_ (a)): _sel_VxA_ (iv, a);
}: fold (_add_SxS_, 0);
}
```
```sh
/tmp|=> ./sac2c/build_d/sac2c_d test-fold.sac
```
```
** 1: Loading SAC program ...
**** Locating source code ...
Reading from file "./test-fold.sac" ...
**** Running C preprocessor ...
**** Parsing input file ...
./test-fold.sac:5:12: error:
=> invalid function name `_add_SxS_' found
./test-fold.sac:7:1: error:
=> token `}' expected, `EOF' token found
abort: Failed to construct a syntax tree for `test-fold.sac'
compilation failed while Loading SAC program, 2 error(s).
```
The problem is that parser expects an identifier, but `_add_SxS_` is a keyword, hence the error.
This can be trivially fixed, given that the backend is happy to accept primitive function as a valid object. The question is: what should `SPFOLD_FN` be in this case? `SPID` or `PRF`?https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2251print N_assign always prints instruction2020-01-28T15:54:26ZHans-Nikolai Viessmannprint N_assign always prints instructionI was tracing problem in print.c when I came across the follow code in `PRTassign`:
```c
instr = ASSIGN_STMT (arg_node);
DBUG_ASSERT (instr != NULL, "instruction of N_assign is NULL");
trav_instr = TRUE;
if (NODE_TYPE (instr) == N_anno...I was tracing problem in print.c when I came across the follow code in `PRTassign`:
```c
instr = ASSIGN_STMT (arg_node);
DBUG_ASSERT (instr != NULL, "instruction of N_assign is NULL");
trav_instr = TRUE;
if (NODE_TYPE (instr) == N_annotate) {
if (global.compiler_phase < PH_cg) {
trav_instr = FALSE;
trav_instr = TRUE;
}
DBUG_EXECUTE_TAG ("PRINT_PROFILE", trav_instr = TRUE);
}
```
I am assuming that when we encounter an N_annotate within the ASSIGN_STMT, we should not traverse through it and print it. Yet here we are overriding the `trav_instr` to be always true, meaning we do. This change was added in commit a0d6a84f51.
Is this intentional?https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2248C compiler error2020-04-14T06:48:25ZColin de RoosC compiler errorI got a C compiler error for code that seems to be accepted by the SaC-compiler.
<details><summary>
Source (can probably be reduced further):</summary><p>
```
use StdIO: all;
use Array: all;
int[*] shapedIota(int[.] shapeVector){
r...I got a C compiler error for code that seems to be accepted by the SaC-compiler.
<details><summary>
Source (can probably be reduced further):</summary><p>
```
use StdIO: all;
use Array: all;
int[*] shapedIota(int[.] shapeVector){
return reshape(shapeVector, iota(prod(shapeVector)));
}
int[*] insert(int[*] x, int i, int[*] a){
return take([i], a) ++ [x] ++ drop([i], a);
}
int[+] transposeNthToFront(int n, int[+] a){
newShape = [shape(a)[n-1]] ++ take([n-1], shape(a)) ++ drop([n], shape(a));
return with {
(0 * newShape <= iv < newShape) : a[insert(iv[0], n - 1, drop([1], iv))];
} : modarray(a);
}
int main(){
print(transposeNthToFront(2, shapedIota([2,3])));
return 0;
}
```
</p></details>
<details><summary>
Compile error:</summary><p>
```shell
$ sac2c -check tc c-error.sac
warning: Option -check c implies option -ecc.
warning: Insertion of explicit conformity checks has been enabled.
In file included from /home/cdfa/Projects/AdvancedProgramming/a.out.c:175:
/home/cdfa/Projects/AdvancedProgramming/a.out.c: In function ‘SACf__MAIN__transposeNthToFront__i__i_X_X’:
/home/cdfa/Projects/AdvancedProgramming/a.out.c:4376:194: error: ‘SACp_emal_17293__icc_3127__shpSAC_d’ undeclared (first use in this function); did you mean ‘SACp_emal_17293__icc_3127__shp1’?
4376 | (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACp_emal_17293__icc_3127, (AKD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))))
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:206:23: note: in definition of macro ‘xCAT12’
206 | #define xCAT12( x, y) x##y
| ^
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:737:55: note: in expansion of macro ‘CAT12’
737 | #define SAC_ND_A_MIRROR_SHAPE__DEFAULT( var_NT, dim) CAT12( NT_NAME( var_NT), CAT20( __shp, dim))
| ^~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:516:26: note: in expansion of macro ‘Item0’
516 | #define NT_NAME( var_NT) Item0 var_NT
| ^~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:737:62: note: in expansion of macro ‘NT_NAME’
737 | #define SAC_ND_A_MIRROR_SHAPE__DEFAULT( var_NT, dim) CAT12( NT_NAME( var_NT), CAT20( __shp, dim))
| ^~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:1413:40: note: in expansion of macro ‘SAC_ND_A_MIRROR_SHAPE__DEFAULT’
1413 | #define SAC_ND_A_MIRROR_SHAPE_AKD(...) SAC_ND_A_MIRROR_SHAPE__DEFAULT(__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:4539:34: note: in expansion of macro ‘SAC_ND_A_MIRROR_SHAPE_AKD’
4539 | #define xCAT_M4_std_gen_21(x, y) x##y
| ^
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:775:48: note: in expansion of macro ‘SAC_ND_A_MIRROR_SHAPE’
775 | #define SAC_ND_A_SHAPE__AKS_AKD( var_NT, dim) SAC_ND_A_MIRROR_SHAPE( var_NT, dim)
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:1529:33: note: in expansion of macro ‘SAC_ND_A_SHAPE__AKS_AKD’
1529 | #define SAC_ND_A_SHAPE_AKD(...) SAC_ND_A_SHAPE__AKS_AKD(__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:4513:34: note: in expansion of macro ‘SAC_ND_A_SHAPE_AKD’
4513 | #define xCAT_M4_std_gen_34(x, y) x##y
| ^
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:139:344: note: in expansion of macro ‘SAC_ND_A_SHAPE’
139 | et_NT, 0) = 0; while( SAC_d > SAC_max_d) { SAC_off_inc *= SAC_ND_A_SHAPE( res_NT, SAC_d); SAC_d--; } SAC_WL_SHAPE_FACTOR( res_NT, 0) = SAC_off_inc; while( SAC_d >= 0) { SAC_ND_WRITE( idx_vec_NT, SAC_d) = 0; SAC_d--; } while( SAC_ND_READ( offset_NT, 0) < SAC_max_off) {
| ^~~~~~~~~~~~~~
/home/cdfa/Projects/AdvancedProgramming/a.out.c:4376:5: note: in expansion of macro ‘SAC_AUD_WL_BEGIN’
4376 | SAC_AUD_WL_BEGIN((SACl_iv, (AKD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT,(NDI, (INT, )))))))))), (SACp_wlidx_15498__icc_3127, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACp_emal_17293__icc_3127, (AKD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))))
| ^~~~~~~~~~~~~~~~
/home/cdfa/Projects/AdvancedProgramming/a.out.c:4376:194: note: each undeclared identifier is reported only once for each function it appears in
4376 | (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACp_emal_17293__icc_3127, (AKD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))))
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:206:23: note: in definition of macro ‘xCAT12’
206 | #define xCAT12( x, y) x##y
| ^
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:737:55: note: in expansion of macro ‘CAT12’
737 | #define SAC_ND_A_MIRROR_SHAPE__DEFAULT( var_NT, dim) CAT12( NT_NAME( var_NT), CAT20( __shp, dim))
| ^~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:516:26: note: in expansion of macro ‘Item0’
516 | #define NT_NAME( var_NT) Item0 var_NT
| ^~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:737:62: note: in expansion of macro ‘NT_NAME’
737 | #define SAC_ND_A_MIRROR_SHAPE__DEFAULT( var_NT, dim) CAT12( NT_NAME( var_NT), CAT20( __shp, dim))
| ^~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:1413:40: note: in expansion of macro ‘SAC_ND_A_MIRROR_SHAPE__DEFAULT’
1413 | #define SAC_ND_A_MIRROR_SHAPE_AKD(...) SAC_ND_A_MIRROR_SHAPE__DEFAULT(__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:4539:34: note: in expansion of macro ‘SAC_ND_A_MIRROR_SHAPE_AKD’
4539 | #define xCAT_M4_std_gen_21(x, y) x##y
| ^
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:775:48: note: in expansion of macro ‘SAC_ND_A_MIRROR_SHAPE’
775 | #define SAC_ND_A_SHAPE__AKS_AKD( var_NT, dim) SAC_ND_A_MIRROR_SHAPE( var_NT, dim)
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:1529:33: note: in expansion of macro ‘SAC_ND_A_SHAPE__AKS_AKD’
1529 | #define SAC_ND_A_SHAPE_AKD(...) SAC_ND_A_SHAPE__AKS_AKD(__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:4513:34: note: in expansion of macro ‘SAC_ND_A_SHAPE_AKD’
4513 | #define xCAT_M4_std_gen_34(x, y) x##y
| ^
/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release/sac.h:139:344: note: in expansion of macro ‘SAC_ND_A_SHAPE’
139 | et_NT, 0) = 0; while( SAC_d > SAC_max_d) { SAC_off_inc *= SAC_ND_A_SHAPE( res_NT, SAC_d); SAC_d--; } SAC_WL_SHAPE_FACTOR( res_NT, 0) = SAC_off_inc; while( SAC_d >= 0) { SAC_ND_WRITE( idx_vec_NT, SAC_d) = 0; SAC_d--; } while( SAC_ND_READ( offset_NT, 0) < SAC_max_off) {
| ^~~~~~~~~~~~~~
/home/cdfa/Projects/AdvancedProgramming/a.out.c:4376:5: note: in expansion of macro ‘SAC_AUD_WL_BEGIN’
4376 | SAC_AUD_WL_BEGIN((SACl_iv, (AKD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT,(NDI, (INT, )))))))))), (SACp_wlidx_15498__icc_3127, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), (SACp_emal_17293__icc_3127, (AKD, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))))
| ^~~~~~~~~~~~~~~~
abort: System failed to execute shell command
abort: /usr/bin/cc -O3 -pedantic -g -fPIC -DPIC -Wall -Wextra
abort: -Wstrict-prototypes -Wno-unused-parameter -Wno-unused-but-set-variable
abort: -march=native -mtune=native -std=gnu99 -pedantic -Wno-unused
abort: -fno-builtin -I. -I/usr/include -DSAC_TARGET_STRING=\"default_sbi\"
abort: -DSAC_MODEXT_STRING=\".so\" -DSAC_TARGET_ENV_STRING=\"host\"
abort: -DSAC_SBI_STRING=\"seq\" -DSAC_RC_METHOD=SAC_RCM_local -DSAC_BACKEND_C99
abort: -DSAC_MT_LIB_ -DSAC_MT_MODE=0 -DSAC_DO_RTSPEC=0
abort: -I/usr/local/include/sac2c/1.2-beta-BlackForest-467-gce8d4/release -c -o
abort: /tmp/SAC_KSBakX/a.out.o /home/cdfa/Projects/AdvancedProgramming/a.out.c
abort: with exit code 1
compilation failed while Creating binary code, 1 warning(s).
```
</p></details>
`sac2c -V`:
```
sac2c 1.2-beta-BlackForest-467-gce8d4
build-type: RELEASE
built-by: "builder" at 2017-04-24T21:49:30
```
StdLib version: `1.3REV2-1` (from AUR package)
`uname -or`: `4.19.69-1-MANJARO GNU/Linux`https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2247Assertion "! WLSTRIDE_ISMODIFIED( stride1)" failed for with-loop with "width"2019-10-17T14:07:57ZColin de RoosAssertion "! WLSTRIDE_ISMODIFIED( stride1)" failed for with-loop with "width"The compiler reports a failed assertion when trying to compile the following code from Listing 31 from the tutorial.
```
use StdIO: all;
use Array: all;
int main()
{
a = with {
(. <= [i,j] <= . step [2,4] width [1,2]): 42;
...The compiler reports a failed assertion when trying to compile the following code from Listing 31 from the tutorial.
```
use StdIO: all;
use Array: all;
int main()
{
a = with {
(. <= [i,j] <= . step [2,4] width [1,2]): 42;
}: genarray([5,6], 0);
print(a);
return 0;
}
```
Command: `sac2c -check tc main.sac`
Output:
```
warning: Option -check c implies option -ecc.
warning: Insertion of explicit conformity checks has been enabled.
Internal compiler error
Assertion "! WLSTRIDE_ISMODIFIED( stride1)" failed at /var/jenkins/workspace/sac2c-packages/cudas/cuda-8.0/label/RHEL7/packs/RPM/phmo/ON/src/libsac2c/wltransform/wltransform.c:3849 -- stride was modified
Please file a bug at: http://bugs.sac-home.org
```
`sac2c -V`:
```
sac2c 1.2-beta-BlackForest-467-gce8d4
build-type: RELEASE
built-by: "builder" at 2017-04-24T21:49:30
```
StdLib version: `1.3REV2-1` (from AUR package)
`uname -or`: `4.19.69-1-MANJARO GNU/Linux`https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2246Runtime specialization and uuid checking at compile time2019-05-22T12:20:31ZPierre FiliolRuntime specialization and uuid checking at compile timeWhen compiling libsac2c it appears that the process does not check for the existence of header /usr/include/uuid/uuid.h
resulting in unrecognized macros and prototypes when attempting to build the stdlib.
example of undefined identifie...When compiling libsac2c it appears that the process does not check for the existence of header /usr/include/uuid/uuid.h
resulting in unrecognized macros and prototypes when attempting to build the stdlib.
example of undefined identifiers : SAC_WE_DECL_REG_FLAG, SAC_WE_FUN_DEF_END2.
The issue was flawlessly solved by installing uuid-dev package (tested on Ubuntu 18.04 LTS), recompiling sac2c and then stdlib.
A complete log is included as well (output when building stdlib with no uuid support in sac2c build).
[makelog.txt](/uploads/d6bed348ce45c4e6de1f75337c6d3323/makelog.txt)https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2241reallocation within outer loop (situation with livermore loop 8)2018-11-21T15:46:18ZHans-Nikolai Viessmannreallocation within outer loop (situation with livermore loop 8)The following example [reallocation-example.sac](/uploads/7bdd0534aae02881f8bd0b0b2437e9bd/reallocation-example.sac), performs some array scalar modification within a double loop nesting. The outer loop forces a repetition of the array m...The following example [reallocation-example.sac](/uploads/7bdd0534aae02881f8bd0b0b2437e9bd/reallocation-example.sac), performs some array scalar modification within a double loop nesting. The outer loop forces a repetition of the array modification which is happening in the inner loop. When we compile with flags `-DBODY -bmem`, we can see that for the outermost loop:
```
int[101] _MAIN::_dup_587_main__Loop_4( int{1} y { ,NN } , int[101] u1 { ,NN } , int i { ,NN } )
{
...
_emlr_6056_y = _alloc_( 1, _dim_A_( y), _shape_A_( y));
_emlr_6057_y = _fill_( _copy_( y), _emlr_6056_y);
_emlr_6054_u1 = _alloc_( 1, _dim_A_( u1), _shape_A_( u1));
_emlr_6055_u1 = _fill_( _copy_( u1), _emlr_6054_u1);
_pinl_588_u1n__SSA0_1 = _MAIN::_dup_589_main__Loop_2( u1, _emlr_6055_u1, _emlr_6057_y) ;
...
}
```
on each iteration we copy `u1` to `_emlr_6055_u1`, meaning on each iteration we create an additional allocation. We see this situation within the Livermore Loop 8 C variant, where we have a triple nesting of loops. Because we are in essence doing `a = op (a)` for the inner loop, we should be able to avoid the extra allocation by performing a buffer swap.
For the current example, this can be done manually be defining our inner loop operation as `b = op (a); a = b;`, where `b` is defined outside the outer loop. If we compile with `-DBODY -DLIFT -bmem`, we get:
```
int[101] _MAIN::_dup_587_main__Loop_4( int{1} y { ,NN } , int[101] u1 { ,NN } , int[101] u1n { ,NN } , int i { ,NN } )
{
...
_emlr_6056_y = _alloc_( 1, _dim_A_( y), _shape_A_( y));
_emlr_6057_y = _fill_( _copy_( y), _emlr_6056_y);
_emlr_6054_u1n = u1n;
_emlr_6055_u1n = _fill_( _noop_( u1n), _emlr_6054_u1n);
_pinl_588_u1n__SSA0_1 = _MAIN::_dup_589_main__Loop_2( u1, _emlr_6055_u1n, _emlr_6057_y) ;
...
}
```
No we no longer perform an allocation/copy, but pass in the extra buffer and reuse it within the outer loop.
It would be nice to do this automatically within the compiler. The attached example also shows a similar case with the inner loop occurring within a separate function. Here though the manual trick from above _does not_ work.https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2240The -noreuse option see to be dead2018-11-03T01:14:19ZArtem ShinkarovThe -noreuse option see to be deadThere is a definition for `-noreuse`, but when passing this to the compiler it complains about invalid option. Quick inspection of `options.c` suggests that it is indeed not defined.There is a definition for `-noreuse`, but when passing this to the compiler it complains about invalid option. Quick inspection of `options.c` suggests that it is indeed not defined.https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2231sac2c -h does not list acceptable targets, e.g, mt_pth, etc.2021-05-25T17:25:36ZRobert Berneckysac2c -h does not list acceptable targets, e.g, mt_pth, etc.This makes it difficult to find out what targets are acceptable, without
spelunking...
This as of:
sac2c -V
sac2c 1.3.2-MijasCosta-36-g34023
build-type: RELEASE
built-by: "sac" at 2018-09-07T13:43:08This makes it difficult to find out what targets are acceptable, without
spelunking...
This as of:
sac2c -V
sac2c 1.3.2-MijasCosta-36-g34023
build-type: RELEASE
built-by: "sac" at 2018-09-07T13:43:08