When adding [[clang::musttail]] to a tail function call the program crashes. Inspection of the output asm clearly shows the stack return address is written over by a skewed memcpy, it copies the struct that is passed on the stack over itself but with a shift of 16 globbering the return address. Without [[clang::musttail] the function runs correctly and -fsanitize=undefined,asan does not indicate any problems
https://godbolt.org/z/Y7fq1xK54
When adding [[clang::musttail]] to a tail function call the program crashes. Inspection of the output asm clearly shows the stack return address is written over by a skewed memcpy, it copies the struct that is passed on the stack over itself but with a shift of 16 globbering the return address. Without [[clang::musttail] the function runs correctly and -fsanitize=undefined,asan does not indicate any problems
https://godbolt.org/z/Y7fq1xK54