pass-struct.c 758 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // RUN: %clangxx %s -O0 -g -fexceptions %extra-clang-opts -o %t
  2. // RUN: %Test_jit_debuginfo %s %t
  3. // XFAIL: host-bcc
  4. // (This testcase is expected to fail because of bcc optimizations that
  5. // are enabled by default in the absence of metadata)
  6. // DEBUGGER: set breakpoint pending on
  7. // DEBUGGER: break test_struct
  8. // DEBUGGER: run
  9. // DEBUGGER: step
  10. // DEBUGGER: print s
  11. // CHECK: $1 = {n = 10, n2 = {20, 21}}
  12. // DEBUGGER: continue
  13. struct int_struct {
  14. int n;
  15. int n2[2];
  16. } compound_int;
  17. int test_struct(struct int_struct s)
  18. {
  19. s.n2[1]++;
  20. return s.n > s.n2[0] ? s.n : s.n2[0];
  21. }
  22. int main(int argc, char* argv[])
  23. {
  24. struct int_struct s;
  25. s.n = 10;
  26. s.n2[0] = 20;
  27. s.n2[1] = 21;
  28. int result = test_struct(s);
  29. return(result == 20 ? 0 : -1);
  30. }