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 19
    • Merge requests 19
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Issues
  • #2227
Closed
Open
Created May 29, 2018 by Sven-Bodo Scholz@sbsOwner

type error treatment leads to compiler warning

noinline
int id( int x)
{ return x; }

int main ()
{

  kx = (_eq_SxS_(id(0), 0) ? _div_SxS_(1,0) : 42);

  return( kx);
}

when compiled with sac2c 1.2-beta-BlackForest-681-gfb545 (level version of Mijas 1.3.2 :-)

on OSX leads to:

/Volumes/Users/sbs/sacbase/LivermoreLoops/loop08/a.out.c:1493:114: warning: variable 'SACp_hce_0' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (SAC_ND_GETVAR((SACp_emal_4688__flat_1, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (BOO, )))))))))), SACp_emal_4688__flat_1)) ^~~~~~~~~~~~~~~~~~~~~~ /Volumes/Users/sbs/sac2c/build_p/include/runtime/essentials_h/std.h:298:33: note: expanded from macro 'SAC_ND_GETVAR' #define SAC_ND_GETVAR(nt, name) name ^~~~ /Volumes/Users/sbs/sacbase/LivermoreLoops/loop08/a.out.c:1514:100: note: uninitialized use occurs here SAC_ND_RET_out( (SAC_arg_1, (SCL, (NHD, (NUQ, (INT, (GLO, (FPM, (NOT, (NDI, (INT, )))))))))), (SACp_hce_0, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, ))))))))))) ^~~~~~~~~~ /Volumes/Users/sbs/sac2c/build_p/include/runtime/essentials_h/std_gen.h:1661:152: note: expanded from macro 'SAC_ND_RET_out' #define SAC_ND_RET_out( arg1, nt ) CAT_M4_std_gen_67(SAC_ND_RET_out_, CAT_M4_std_gen_68(NT_SHP(nt), CAT_M4_std_gen_69(NT_HID(nt), NT_UNQ(nt))))( arg1, nt ) ^~ /Volumes/Users/sbs/sac2c/build_p/include/runtime/essentials_h/std_gen.h:1662:62: note: expanded from macro 'SAC_ND_RET_out_SCLNHDNUQ' #define SAC_ND_RET_out_SCLNHDNUQ(...) SAC_ND_RET_out__NODESC(VA_ARGS) ^~~~~~~~~~~ /Volumes/Users/sbs/sac2c/build_p/include/runtime/essentials_h/std.h:1339:52: note: expanded from macro 'SAC_ND_RET_out__NODESC' = SAC_ND_GETVAR (var_NT, SAC_ND_A_FIELD (var_NT));
^~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /Volumes/Users/sbs/sac2c/build_p/include/runtime/essentials_h/std.h:87:31: note: expanded from macro 'NT_NAME' #define NT_NAME(var_NT) Item0 var_NT ^~~~~~ /Volumes/Users/sbs/sac2c/build_p/include/runtime/essentials_h/icm.h:68:21: note: expanded from macro 'Item0' #define Item0(a, b) a ^ /Volumes/Users/sbs/sac2c/build_p/include/runtime/essentials_h/std.h:298:33: note: expanded from macro 'SAC_ND_GETVAR' #define SAC_ND_GETVAR(nt, name) name ^~~~ /Volumes/Users/sbs/sacbase/LivermoreLoops/loop08/a.out.c:1493:5: note: remove the 'if' if its condition is always false if (SAC_ND_GETVAR((SACp_emal_4688__flat_1, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (BOO, )))))))))), SACp_emal_4688__flat_1)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Volumes/Users/sbs/sacbase/LivermoreLoops/loop08/a.out.c:1466:103: note: variable 'SACp_hce_0' is declared here SAC_ND_DECL__DATA( (SACp_hce_0, (SCL, (NHD, (NUQ, (INT, (GLO, (NON, (NOT, (NDI, (INT, )))))))))), int, ) ^ 1 warning generated.

However, the code delivers the correct result :-) ie a type error!

Edited May 29, 2018 by Sven-Bodo Scholz
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking