https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51259
Matthijs Kooijman <matthijs at stdin dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matthijs at stdin dot nl --- Comment #2 from Matthijs Kooijman <matthijs at stdin dot nl> --- I just stumbled upon this same issue. The most direct course seems to be to fix the documentation to match the implmentation. In his comment Shakthi Kannan runs the gcc -E output through hexdump -c and says that the octal value is present there, but that's just hexdump that shows any non-printable characters in the file using on octal value. The raw byte is still present in the gcc output. To confirm, here's another testcase: $ touch $'foo\001bar.cpp' $ gcc -E foo^Abar.cpp # 1 "foobar.cpp" # 1 "<built-in>" # 1 "<command-line>" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 1 "<command-line>" 2 # 1 "foobar.cpp" $ gcc -E foo^Abar.cpp |hd 00 23 20 31 20 22 66 6f 6f 01 62 61 72 2e 63 70 70 |# 1 "foo.bar.cpp| 10 22 0a 23 20 31 20 22 3c 62 75 69 6c 74 2d 69 6e |".# 1 "<built-in| 20 3e 22 0a 23 20 31 20 22 3c 63 6f 6d 6d 61 6e 64 |>".# 1 "<command| 30 2d 6c 69 6e 65 3e 22 0a 23 20 31 20 22 2f 75 73 |-line>".# 1 "/us| 40 72 2f 69 6e 63 6c 75 64 65 2f 73 74 64 63 2d 70 |r/include/stdc-p| 50 72 65 64 65 66 2e 68 22 20 31 20 33 20 34 0a 23 |redef.h" 1 3 4.#| 60 20 31 20 22 3c 63 6f 6d 6d 61 6e 64 2d 6c 69 6e | 1 "<command-lin| 70 65 3e 22 20 32 0a 23 20 31 20 22 66 6f 6f 01 62 |e>" 2.# 1 "foo.b| 80 61 72 2e 63 70 70 22 0a |ar.cpp".| 88 (Note that my terminal seems to hide the control character in the direct gcc output, but obviously no octal escape is present, and hexdump confirms that the raw byte is present) Looking at the code, you can see the line marker is generated here: https://github.com/gcc-mirror/gcc/blob/edd716b6b1caa1a5cb320a8cd7f626f30198e098/gcc/c-family/c-ppoutput.c#L413-L415 And the escaping of the filename happens here: https://github.com/gcc-mirror/gcc/blob/a588355ab948cf551bc9d2b89f18e5ae5140f52c/libcpp/macro.c#L491-L511 So only \ and " are escaped, nothing else.