tinycc/tests/tests2/101_cleanup.expect
herman ten brugge b6a16e3be4
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled
Save registers around attribute cleanup
This makes attribute cleanup code work the same as gcc and also
makes bound checking a very little bit faster.

tcc.h:
  Add save_return_reg(CType *) and restore_return_reg(CType *)
  Change gfunc_epilog() to gfunc_epilog(Sym *)

arm-gen.c:
arm64-gen.c:
c67-gen.c:
i386-gen.c:
il-gen.c:
riscv64-gen.c:
x86_64-gen.c:
  Move save and restore register around bound_local_delete call
  to save_return_reg and restore_return_reg.
  Pass func_type from gfunc_epilog to gen_bounds_epilog.

tccgen.c:
  Call save_return_reg/restore_return_reg in try_call_scope_cleanup
  when RETURN is found.

tccrun.c:
  Fix warning when bound checking not used.

tests/tests2/101_cleanup.c
tests/tests2/101_cleanup.expect
  Extra checks attribute cleanup save/restore registers.

tests/tests2/Makefile:
  Fix when bound checking not used.
2025-05-22 16:58:12 +02:00

70 lines
731 B
Plaintext

c: a
c: o
glob_i: 65536
oo: 2.600000
c: f
str: I don't think this should be print(but gcc got it wrong too)
because what if free was call inside cleanup function I don't think this should be print(but gcc got it wrong too)
should be print before
str: that
str: this should appear only once
str: -that2
str: -that
str: test2
str: one
---- 1
str: two
str: three
-- loop 0 --
100
100
100
100
100
100
100
100
100
100
10
-- loop 1 --
200
200
200
200
200
200
200
200
200
200
10
-- loop 2 --
300
0
-- loop 3 --
400
500
400
after break
1000
42
42
42 43 44 45 46 47 48 49
42 43 44 45 46 47 48 49
42 43 44 45
42 43 44 45
42 43
42 43
42.000000
42.000000
---- 0
---- 1
str: plop
str: tata !
str: 3
str: 2
str: 1
str: last goto out
str: wololo