fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void hello(void)
  5. {
  6. puts("Hello!");
  7. }
  8.  
  9. void goodbye(void)
  10. {
  11. puts("Goodbye!");
  12. }
  13.  
  14. void set_sp_(void *p)
  15. {
  16. void *s[0];
  17. s[0] = p;
  18. }
  19.  
  20. void set_sp(void *p)
  21. {
  22. set_sp_((void*)p);
  23. }
  24.  
  25. int main(void)
  26. {
  27. void *new_stack[1024] = {
  28. [1019] = (void*)0,
  29. [1020] = (void*)&hello,
  30. [1021] = (void*)&goodbye,
  31. [1022] = (void*)&exit
  32. };
  33. set_sp((void*)&new_stack[1019]);
  34. return 0;
  35. }
  36.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘set_sp_’:
prog.c:16:15: error: ISO C forbids zero-size array ‘s’ [-Werror=pedantic]
         void *s[0];
               ^
prog.c:16:15: error: variable ‘s’ set but not used [-Werror=unused-but-set-variable]
prog.c: In function ‘main’:
prog.c:29:26: error: ISO C forbids conversion of function pointer to object pointer type [-Werror=pedantic]
                 [1020] = (void*)&hello,
                          ^
prog.c:30:26: error: ISO C forbids conversion of function pointer to object pointer type [-Werror=pedantic]
                 [1021] = (void*)&goodbye,
                          ^
prog.c:31:26: error: ISO C forbids conversion of function pointer to object pointer type [-Werror=pedantic]
                 [1022] = (void*)&exit
                          ^
cc1: all warnings being treated as errors
stdout
Standard output is empty