.ascii "Hello World!\12\0"
I explicitly null terminated it like you said and the segfault is still thereDoes gas syntax even recognize regex? If not, you should replace '\n' with '\12'. If you are running the code as a .s file, the 3rd line would need to read as follows:
Code:.ascii "Hello World!\12\0"
This is because ASCII strings in a C routine need to be null terminated, hence the '\0'. Apply this fix, then tell me if it works.
.data
str:
.ascii "Hello World!\12\0"
.text
.globl main
.extern printf
main:
movq str,%rdi
call printf
ret