Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 395
    • Issues 395
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2248
Closed
Open
Created Sep 19, 2019 by Colin de Roos@cdfa

C compiler error

I got a C compiler error for code that seems to be accepted by the SaC-compiler.

Source (can probably be reduced further):

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;
}
Compile error:

$ 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).

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

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking