sac2c issueshttps://gitlab.sac-home.org/sac-group/sac2c/-/issues2024-03-25T14:34:38Zhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2393Out of memory compile error2024-03-25T14:34:38ZThomas KoopmanOut of memory compile error```
use StdIO: all;
int main()
{
m = 1000;
x = {iv -> 1 | iv < [m]};
StdIO::print(x);
return 0;
}
```
fails with `Out of memory: 751605325050240 bytes requested`. Compiled with commit `9b80bcfd0ad24d93a1cab9c365ac1fea723fe6d5...```
use StdIO: all;
int main()
{
m = 1000;
x = {iv -> 1 | iv < [m]};
StdIO::print(x);
return 0;
}
```
fails with `Out of memory: 751605325050240 bytes requested`. Compiled with commit `9b80bcfd0ad24d93a1cab9c365ac1fea723fe6d5`, no flagshttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2392Bug in class implementation2024-03-09T10:32:01ZArtem ShinkarovBug in class implementationHere is a definition of the class which is a counter, where the update effect is merged into the `value` accessor:
```c
class cnt;
classtype int;
export all;
cnt new (int x) {
return to_cnt (x);
}
int value (cnt &x) {
v = from_cnt ...Here is a definition of the class which is a counter, where the update effect is merged into the `value` accessor:
```c
class cnt;
classtype int;
export all;
cnt new (int x) {
return to_cnt (x);
}
int value (cnt &x) {
v = from_cnt (x);
x = to_cnt (_add_SxS_ (v, 1));
return v;
}
```
Here is the file that uses this class:
```c
use cnt:all;
int main () {
a = new (1);
return value (a);
}
```
When I run this, I get the value 2 back, but the correct result is 1.
The version of sac2c I used is: `sac2c 1.3.3-MijasCosta-1161-gb543c`Sven-Bodo ScholzSven-Bodo Scholzhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/23881 / (1 + inf) gives nan instead of 02024-02-21T16:00:28ZThomas Koopman1 / (1 + inf) gives nan instead of 0# SaC version
sac2c 1.3.3-MijasCosta-1161-gb543c
build-type: DEBUG
built-by: "thomas" at 2024-02-21T12:07:11
# Test program
```
/* We need expf so Stdlib is necessary */
use Array: all;
use Math: all;
inline
float[*] logistics(float[...# SaC version
sac2c 1.3.3-MijasCosta-1161-gb543c
build-type: DEBUG
built-by: "thomas" at 2024-02-21T12:07:11
# Test program
```
/* We need expf so Stdlib is necessary */
use Array: all;
use Math: all;
inline
float[*] logistics(float[*] x)
{
return {iv -> 1f / (1f + exp(-x[iv]))};
}
noinline
float[d:shp] id(float[d:shp] x)
{
return x;
}
int main()
{
c11 = id(with {}: genarray([6, 24, 24], -1875001.750000f));
/* Note that this is well defined under IEEE-754:
exp(-x[iv]) = +inf
1 + +inf = +inf
1 / +inf = 0+
*/
c1 = logistics(c11);
StdIO::print(c1);
return 0;
}
```
# Output
When compiling without arguments, prints all NaN (with gcc 13.2.0 and clang 14.0.6). When passing `-Xc -O2` it does give the correct result, which is all `0`s.
Stepping through with `gdb` shows that the `+ 1` and division are optimised away from O3 onwards. It is possible that the generated C code is incorrect, but `-fsanitize=undefined` finds nothing. I may have to boil this down to a minimal example and file a bug with `gcc` and `clang` if it is not on our end.https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2361Type pattern dimensionality check done too late2023-12-08T12:14:50ZJordy AalderingType pattern dimensionality check done too lateDimensionality checks generated for type patterns are inserted too late into the check functions, currently it is:
```
assigns
dim checks
checks
```
But to avoid executing erroneous code in the assigns it should be:
```
dim checks
ass...Dimensionality checks generated for type patterns are inserted too late into the check functions, currently it is:
```
assigns
dim checks
checks
```
But to avoid executing erroneous code in the assigns it should be:
```
dim checks
assigns
checks
```
Example:
```
use Array: all;
int[o] concat( int[m] x, int[n] y) | o == m+n
{
return {[i] -> x[i];
[i] -> y[i-m] | [m] <= [i] < [m+n] };
}
int[d:shp] mysel( int[n] idx, int[n:outer, d:shp] arr) | all (0 <= idx) && all (idx < outer)
{
return {iv -> _sel_VxA_ (concat (idx, iv), arr) | iv < shp};
}
int main () {
res = mysel ([1,2,2], reshape ([3,4], iota(12)));
return res;
}
```Jordy AalderingJordy Aalderinghttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2356Multithreaded AKD fold2024-01-11T15:45:51ZThomas KoopmanMultithreaded AKD fold# Compiler version
```
sac2c 1.3.3-MijasCosta-1111-g2cfd20
build-type: DEBUG
```
# Problem
The following program concetenates 100 `[1]`s into a single array and prints the shape.
```
int[.] rijgen(int[m] x, int[n] y)
{
res_shape =...# Compiler version
```
sac2c 1.3.3-MijasCosta-1111-g2cfd20
build-type: DEBUG
```
# Problem
The following program concetenates 100 `[1]`s into a single array and prints the shape.
```
int[.] rijgen(int[m] x, int[n] y)
{
res_shape = [_add_SxS_(m, n)];
conny = with {
([0] <= iv < [m]): _sel_VxA_(iv, x);
([m] <= iv < res_shape): _sel_VxA_(_sub_VxV_(iv, [m]),
y);
}: genarray(res_shape, 0);
return conny;
}
int main()
{
n = 100;
jean = with {
([0] <= iv < [n]): [1];
}: fold(rijgen, []);
return _sel_VxA_([0], _shape_A_(jean));
}
```
This gives error
```
*** SAC runtime error
*** No appropriate instance of function "_MAIN::rijgen :: int[*] int[*] -> int[.] " found!
```
for backend `mt_pth`.
# Investigation
The problem seems to be that
```MT_MTFUN_DEF_BEGIN( SACwf__MAIN_CL_MT__rijgen__i_S__i_S, , 3, out, int, (SAC_arg_1, (AKD, (NHD, (NUQ, (INT, (GLO, (FPM, (NOT, (NDI, (INT, )))))))))), in, int, (SACl_x, (AUD, (NHD, (NUQ, (INT, (GLO, (FPM, (NOT, (NDI, (INT, )))))))))), in, int, (SACl_y, (AUD, (NHD, (NUQ, (INT, (GLO, (FPM, (NOT, (NDI, (INT, )))))))))))```
forgets that arguments x and y are `AKD`, and turns it into an `AUD`.https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2346Phase memrt fails2023-11-23T11:28:49ZThomas KoopmanPhase memrt failsCompiled with `sac2c -t cuda`, fails in phase memrt, node prf.
Version
```
sac2c 1.3.3-MijasCosta-1079-g648dba-dirty
build-type: DEBUG
built-by: "thomas" at 2023-10-11T13:56:05
```
dirty only because I added extra debug prints.
```
...Compiled with `sac2c -t cuda`, fails in phase memrt, node prf.
Version
```
sac2c 1.3.3-MijasCosta-1079-g648dba-dirty
build-type: DEBUG
built-by: "thomas" at 2023-10-11T13:56:05
```
dirty only because I added extra debug prints.
```
#define N 32
inline
double[*] coarse2fine (double[*] z)
{
// return {iv -> z[(iv - 1) / 2] | [1, 1, 1] <= iv < 2 * shape(z) step [2, 2, 2] };
new_shp = _mul_SxV_(2, _shape_A_(z));
return with {
([1, 1, 1] <= iv < new_shp step [2, 2, 2]):
_sel_VxA_(_div_VxS_(_sub_VxV_(iv,
[1, 1, 1]),
2),
z);
}: genarray(new_shp, 0d);
}
inline
double[*] fine2coarse(double[*] r)
{
// return {iv -> r[2 * iv + 1] | iv < shape(r) / 2};
new_shp = _div_VxV_(_shape_A_(r), [2, 2, 2]);
return with {
([0, 0, 0] <= iv < new_shp):
_sel_VxA_(
_add_VxV_(_mul_SxV_(2, iv),
[1, 1, 1]),
r);
}: genarray(new_shp, 0d);
}
/* This specialization must be here for the error to occur.
specialization must also be at least 16. */
specialize double[16,16,16] M (double[16,16,16] r);
double[.,.,.] M (double[.,.,.] r)
{
rs = fine2coarse(r);
zs = M (rs);
z = coarse2fine(zs);
return z;
}
double[4,4,4] M (double[4,4,4] r)
{
return r;
}
double MG (double[N,N,N] v, double[N,N,N] u)
{
/* Must be at least 4 for the error to occur. */
// for (i = 1; i < 4; i++) {
// r = v - u;
// u = u + M(r);
// }
// return u[0, 0, 0];
for (i = 1; _le_SxS_(i, 4); i = _add_SxS_(i, 1)) {
r = with {
(. <= iv <= .): _sub_SxS_(_sel_VxA_(iv, v),
_sel_VxA_(iv, u));
}: genarray(_shape_A_(v), 0d);
Mr = M(r);
u = with {
(. <= iv <= .): _add_SxS_(_sel_VxA_(iv, u),
_sel_VxA_(iv, Mr));
}: genarray(_shape_A_(u), 0d);
}
return _sel_VxA_([0, 0, 0], u);
}
int main()
{
u = with {
([0, 0, 0] <= iv <= [N, N, N]): 2d;
}: genarray([N, N, N], 0d);
v = u;
r = MG (v, u);
return _toi_S_(r);
}
```Hans-Nikolai ViessmannHans-Nikolai Viessmannhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2328Internal compiler error of COzipCvUByteAbs during Stdlib build of ArrayArith2023-02-26T21:58:04ZHans-Nikolai ViessmannInternal compiler error of COzipCvUByteAbs during Stdlib build of ArrayArithAfter !217 SAC package building fails in building Stdlib `ArrayArith` module (output in https://gitlab.sac-home.org/sac-group/build-sac-pkgs/-/pipelines/1512, but its not very clear whats going on), issuing the following error:
```
Inter...After !217 SAC package building fails in building Stdlib `ArrayArith` module (output in https://gitlab.sac-home.org/sac-group/build-sac-pkgs/-/pipelines/1512, but its not very clear whats going on), issuing the following error:
```
Internal compiler error
Program reached impossible state at /home/hans/git/sac/sac2c/src/libsac2c/constants/zipcv.c:260 -- COzipCvUByteAbs called !
```
This error **ONLY** happens when we build Stdlib using `-DFULLTYPES=ON`, which is why this has neither affected this repo's MR pipelines or the Stdlib Github actions...Sven-Bodo ScholzSven-Bodo Scholzhttps://gitlab.sac-home.org/sac-group/sac2c/-/issues/2324WLUR causing a loss in type precision? Yet another instance of the AUDGZ-prob...2023-01-25T17:18:58ZMichiel VerloopWLUR causing a loss in type precision? Yet another instance of the AUDGZ-problem!Compiling the below program with `sac2c -maxspec 0 -noinl` causes a compiler error:
```
use Array: {tof, toi, sel};
int main()
{
grid = {iv -> tof([0]) | iv < [1] };
return toi(grid[0, 0]);
}
```
The error:
```
Internal compil...Compiling the below program with `sac2c -maxspec 0 -noinl` causes a compiler error:
```
use Array: {tof, toi, sel};
int main()
{
grid = {iv -> tof([0]) | iv < [1] };
return toi(grid[0, 0]);
}
```
The error:
```
Internal compiler error
Program reached impossible state at /home/username/sac2c/src/libsac2c/typecheck/elim_alpha_types.c:435 -- new element type `float[*]' of array `_wlur_25' does not match old type `float[+]' on the left hand side
Please file a bug at: https://gitlab.sac-home.org/sac-group/sac2c/-/issues
```
The error is not triggered when `tof()` is removed or computed `tof()` over the entire grid.
`-maxspec 0 -noinl` might seem like an oddly specific combination, but it's very effective at compiling a project quickly at the cost of runtime performance, making it excellent for debugging purposes.
Output of `sac2c -V`:
```
sac2c 1.3.3-MijasCosta-1040-g893498
build-type: DEBUG
built-by: "username" at 2023-01-25T15:48:20
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2319WLF bug - weird out-of-bound-access error message2022-11-05T17:39:21ZSven-Bodo ScholzWLF bug - weird out-of-bound-access error messageout-of-bound error in WLF. Using sac2c `sac2c 1.3.3-MijasCosta-1004-ge257a-dirty build-type: DEBUG` the following program:
```
int + (int a, int b) {return _add_SxS_ (a, b); }
int main()
{
a = with {} : genarray ([5,10], 0);
c ...out-of-bound error in WLF. Using sac2c `sac2c 1.3.3-MijasCosta-1004-ge257a-dirty build-type: DEBUG` the following program:
```
int + (int a, int b) {return _add_SxS_ (a, b); }
int main()
{
a = with {} : genarray ([5,10], 0);
c = with {} : genarray([10,10], 0);
new = with {
( [0,0] <= [i,j] < [5,5]) : with { ([0] <= [k] < [10]): _sel_VxA_ ([i,k], a);
} : fold (+,0);
} : genarray ([5,5], 0);
c = with {
( [5,0] <= iv < [10,5] ) : _sel_VxA_ (_sub_VxV_( iv , [5,0]), new) ;
} : modarray (c);
return _sel_VxA_ ([5,2], c);
}
```
yields:
```
-sbs-SvenBodosAir2-> sac2c-d WLFbug.sac
** 1: Loading SAC program ...
** 2: Preprocessing SAC program ...
** 3: Running module system ...
** 4: Simplifying source code ...
** 5: Converting to static single assignment form ...
** 6: Running type inference system ...
** 7: Processing exports ...
** 8: Preparing for code optimization ...
** 9: Enhancing with-loops ...
** 10: Running SAC optimizations ...
./WLFbug.sac:9:87: abort:
Array access to a out of range in dimension 1
Compilation failed while Running SAC optimizations.
```https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2312negative upper bound check on WLs wrong!2022-03-23T09:42:15ZSven-Bodo Scholznegative upper bound check on WLs wrong!The following is legal SaC but ICC (`-check c`) triggers an error:
```
int main()
{
a = with {
( [0] <= iv < [ _neg_S_(5)]) : 42;
} : genarray( [12], 0);
return _sel_VxA_([3], a);
}
```
ICC needs to be adjusted ...The following is legal SaC but ICC (`-check c`) triggers an error:
```
int main()
{
a = with {
( [0] <= iv < [ _neg_S_(5)]) : 42;
} : genarray( [12], 0);
return _sel_VxA_([3], a);
}
```
ICC needs to be adjusted accordingly and we should check with all WL-operators whether all possible transformation passes can deal properly with non-standard partitions....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/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/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/2223Compiler assertion on incorrect number of arguments to primitive function2018-04-13T23:50:28ZArtem ShinkarovCompiler assertion on incorrect number of arguments to primitive functionHere is a test file:
```sh
$ cat test.sac
int main ()
{
return _add_SxS_ (1);
}
```
Here is what I get when calling sac2c:
```sh
/tmp|=> sac2c test.sac
Internal compiler error
Assertion "TYgetProductSize( args) == 2" failed at /tmp/s...Here is a test file:
```sh
$ cat test.sac
int main ()
{
return _add_SxS_ (1);
}
```
Here is what I get when calling sac2c:
```sh
/tmp|=> sac2c test.sac
Internal compiler error
Assertion "TYgetProductSize( args) == 2" failed at /tmp/sac2c/src/libsac2c/typecheck/ct_prf.c:2476 -- ari_op_SxV called with incorrect number of arguments
Please file a bug at: http://bugs.sac-home.org
```
This should be an error, not a compiler assertion.
https://gitlab.sac-home.org/sac-group/sac2c/-/issues/2138three dots as arguments unsafer than expected2021-08-30T15:56:59ZSven-Bodo Scholzthree dots as arguments unsafer than expected| | |
| --- | --- |
| Bugzilla Link | [521](http://bugs.sac-home.org/show_bug.cgi?id=521) |
| Created on | Jul 07, 2009 14:45 |
| Version | 1.00beta |
| OS | Linux |
| Architecture | PC |
| Attachments | [tutu.sac](/uploads/6e449df16f5...| | |
| --- | --- |
| Bugzilla Link | [521](http://bugs.sac-home.org/show_bug.cgi?id=521) |
| Created on | Jul 07, 2009 14:45 |
| Version | 1.00beta |
| OS | Linux |
| Architecture | PC |
| Attachments | [tutu.sac](/uploads/6e449df16f5940c2e6e5d42fd468ef60/tutu.sac) |
## Extended Description
<pre>Created an attachment (id=549)
source code
compile with -maxspec 0 and the 5.0 will be printed as 0.0000.
The reason for this is that the scalar value comes as AUD and therefore
in boxed form. As it is in ... position of printf, precompile cannot
insert appropriate casts to make sure an unboxed double is passed to the
actual printf implementation.
inlining or specialisations obviously make this problem go away....</pre>BugZillaBugZilla