kevinlawler / kona

Open-source implementation of the K programming language
ISC License
1.36k stars 138 forks source link

Compiler Warning: address of local variable #645

Open micwoj92 opened 1 month ago

micwoj92 commented 1 month ago

Similar to #603

Using gcc 14.1

rc/kx.c: In function ‘ex’:
src/kx.c:637:8: warning: function may return address of local variable [-Wreturn-local-addr]
  637 |   R z; }
      |        ^
src/kx.c:614:8: note: declared here
  614 | K ex(K a)   //Input is (usually, but not always) 7-0 type from wd()
      |      ~~^
bakul commented 1 month ago

Function ex_ seems to be the culprit here. It has a return type of V, not K and it returns a value of type V in one place and of type K in another.