Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include <stdio.h>
  2.  
  3. /* This test segfaults as of April 27, 2015. */
  4. void f1(int argc)
  5. {
  6.   char test[argc];
  7.   if(0)
  8.   label:
  9.     printf("boom!\n");
  10.   if(argc-- == 0)
  11.     return;
  12.   goto label;
  13. }
  14.  
  15. /* This segfaulted on 2015-11-19. */
  16. void f2(void)
  17. {
  18.     goto start;
  19.     {
  20.         int a[1 && 1]; /* not a variable-length array */
  21.         int b[1 || 1]; /* not a variable-length array */
  22.         int c[1 ? 1 : 1]; /* not a variable-length array */
  23.     start:
  24.         a[0] = 0;
  25.         b[0] = 0;
  26.         c[0] = 0;
  27.     }
  28. }
  29.  
  30. void f3(void)
  31. {
  32.     printf("%d\n", 0 ? printf("x1\n") : 11);
  33.     printf("%d\n", 1 ? 12 : printf("x2\n"));
  34.     printf("%d\n", 0 && printf("x3\n"));
  35.     printf("%d\n", 1 || printf("x4\n"));
  36. }
  37.  
  38. int main()
  39. {
  40.   f1(2);
  41.   f2();
  42.   f3();
  43.  
  44.   return 0;
  45. }
  46.