GCC generates invalid character when compiling hello world program

Stefan Ring stefanrin@gmail.com
Sun Aug 8 09:49:09 GMT 2021

On Sun, Aug 8, 2021 at 7:45 AM bootmgr--- via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
> The gcc I compiled generated wrong assembly code on Windows.
> This gcc is Canadian compiled from Ubuntu, and I did not apply any patches on https://github.com/msys2/MINGW-packages.
> Error Messages:
> H:\cxx>gcc hw.c
> C:\Users\ADMINI~1\AppData\Local\Temp\ccaNW5Tf.s: Assembler messages:
> C:\Users\ADMINI~1\AppData\Local\Temp\ccaNW5Tf.s:39: Warning: missing closing `"'
> C:\Users\ADMINI~1\AppData\Local\Temp\ccaNW5Tf.s:39: Error: invalid character (0xa in mnemonic
> GCC configured by ../gcc/configure --disable-multilib --disable-nls --disable-rpath --disable-win32-registry --enable-gra
> phite --enable-languages=c,c++,lto --enable-mingw-wildcard --enable-threads=posix --disable-libstdcxx-pch --disable-libs
> tdcxx-verbose --enable-fully-dynamic-string --enable-large-address-aware --host=x86_64-w64-mingw32 --target=x86_64-w64-m
> ingw32 --prefix=/mingw64

The problem is this line (and it’s not line number 39, as in your
error message):

    .ascii "Hello world!\^@"^M (as displayed by Emacs)

The last few characters in hex: 5c 00 22 0d 0a. There is a 00 byte
after the backslash for some reason.

More information about the Gcc-help mailing list