public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101823] New: GCC generates the wrong string in the assembly code.
@ 2021-08-09  5:57 bootmgr at 163 dot com
  2021-08-09  5:57 ` [Bug c++/101823] " bootmgr at 163 dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bootmgr at 163 dot com @ 2021-08-09  5:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

            Bug ID: 101823
           Summary: GCC generates the wrong string in the assembly code.
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bootmgr at 163 dot com
  Target Milestone: ---

Created attachment 51275
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51275&action=edit
test.s

The gcc I compiled generated wrong assembly code on Windows.
This gcc is Canadian compiled from Ubuntu.

Error Messages:
H:\cxx>g++ test.cc
C:\Users\ADMINI~1\AppData\Local\Temp\ccxMVKI1.s: Assembler messages:
C:\Users\ADMINI~1\AppData\Local\Temp\ccxMVKI1.s:43: Warning: missing closing
`"'
C:\Users\ADMINI~1\AppData\Local\Temp\ccxMVKI1.s:43: Error: invalid character
(0xa in mnemonic

Configured with: ../gcc/configure --disable-multilib --disable-nls
--disable-rpath --disable-win32-registry --enable-graphite
--enable-languages=c,c++,jit,lto --enable-mingw-wildcard --enable-threads=posix
--disable-libstdcxx-pch --disable-
libstdcxx-verbose --enable-fully-dynamic-string --enable-large-address-aware
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/101823] GCC generates the wrong string in the assembly code.
  2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
@ 2021-08-09  5:57 ` bootmgr at 163 dot com
  2021-08-12 22:11 ` [Bug target/101823] " bootmgr at 163 dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bootmgr at 163 dot com @ 2021-08-09  5:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #1 from bootmgr at 163 dot com <bootmgr at 163 dot com> ---
Created attachment 51276
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51276&action=edit
test.cc

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/101823] GCC generates the wrong string in the assembly code.
  2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
  2021-08-09  5:57 ` [Bug c++/101823] " bootmgr at 163 dot com
@ 2021-08-12 22:11 ` bootmgr at 163 dot com
  2023-01-17 19:15 ` i.nixman at autistici dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bootmgr at 163 dot com @ 2021-08-12 22:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #2 from bootmgr at 163 dot com <bootmgr at 163 dot com> ---
I reconfigured gcc with --enable-threads=win32 (not --enable-threads=posix) and
this gcc can compile the program correctly.The posix thread model cannot.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/101823] GCC generates the wrong string in the assembly code.
  2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
  2021-08-09  5:57 ` [Bug c++/101823] " bootmgr at 163 dot com
  2021-08-12 22:11 ` [Bug target/101823] " bootmgr at 163 dot com
@ 2023-01-17 19:15 ` i.nixman at autistici dot org
  2023-01-17 19:18 ` i.nixman at autistici dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: i.nixman at autistici dot org @ 2023-01-17 19:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #3 from niXman <i.nixman at autistici dot org> ---

> The gcc I compiled generated wrong assembly code on Windows.
> This gcc is Canadian compiled from Ubuntu.

what GCC version was used on the host?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/101823] GCC generates the wrong string in the assembly code.
  2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
                   ` (2 preceding siblings ...)
  2023-01-17 19:15 ` i.nixman at autistici dot org
@ 2023-01-17 19:18 ` i.nixman at autistici dot org
  2023-01-19  9:26 ` bootmgr at 163 dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: i.nixman at autistici dot org @ 2023-01-17 19:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #4 from niXman <i.nixman at autistici dot org> ---

> The gcc I compiled generated wrong assembly code on Windows.
> This gcc is Canadian compiled from Ubuntu.

please provide the step-by-step instruction you used.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/101823] GCC generates the wrong string in the assembly code.
  2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
                   ` (3 preceding siblings ...)
  2023-01-17 19:18 ` i.nixman at autistici dot org
@ 2023-01-19  9:26 ` bootmgr at 163 dot com
  2023-01-19  9:27 ` bootmgr at 163 dot com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bootmgr at 163 dot com @ 2023-01-19  9:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #5 from bootmgr at 163 dot com <bootmgr at 163 dot com> ---
(In reply to niXman from comment #4)
> please provide the step-by-step instruction you used.
1. Extract binutils gcc mingw-w64 files to any where
Extract gmp mpfr mpc isl to gcc source directory
note: please make sure no subdirectories are included under
gcc-x.x.x/{gmp,mpfr,mpc,isl}.
these file can be found here
http://ftp.gnu.org/gnu/binutils/
http://ftp.gnu.org/gnu/gcc/
https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/
https://gmplib.org/#DOWNLOAD
https://www.mpfr.org/mpfr-current/#download
https://www.multiprecision.org/mpc/download.html
https://libisl.sourceforge.io/

2. Clone the windows default manifest
(git://cygwin.com/git/cygwin-apps/windows-default-manifest.git)

3. These instructions are used to build cross toolchain and install to /mingw
(can be changed to other directory).
note: use "make -j$(nproc)" instead "make" to use more CPU cores.

1) Set PREFIX and PATH variables

export PREFIX=/mingw
export PATH=$PATH:$PREFIX/bin
note: if you are not root, please run "sudo mkdir /mingw && sudo chmod 777
/mingw"

2) chdir to gcc source directory and run "sed -i
's/${prefix}\/mingw\//${prefix}\//g' configure"
see also
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-gcc/PKGBUILD#L155

3) Build binutils
../binutils-2.40/configure --disable-nls --disable-rpath --enable-64-bit-bfd
--enable-deterministic-archives --enable-install-libiberty
--target=x86_64-w64-mingw32 --prefix=$PREFIX
make && make install-strip

4) Install mingw-w64 headers
../mingw-w64-v10.0.0/mingw-w64-headers/configure --host=x86_64-w64-mingw32
--prefix=$PREFIX/x86_64-w64-mingw32
make && make install -j16

5) Build GCC core compiler
../gcc-12.2.0/configure --disable-multilib --disable-nls --disable-rpath
--disable-symvers --enable-languages=c,c++,lto --enable-mingw-wildcard
--enable-threads=posix --enable-libgomp --disable-libstdcxx-verbose
--enable-fully-dynamic-string --target=x86_64-w64-mingw32 --prefix=$PREFIX
make all-gcc && make install-strip-gcc

6) Build mingw-w64
../mingw-w64-v10.0.0/configure --enable-experimental --disable-lib32
--host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32
make && make install-strip

7) Build winpthreads (pthread support for windows)
../mingw-w64-v10.0.0/mingw-w64-libraries/winpthreads/configure
--host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32

8) Build windows default manifest
x86_64-w64-mingw32-windres -F pe-x86-64
./windows-default-manifest/default-manifest.rc -o
$PREFIX/x86_64-w64-mingw32/lib/default-manifest.o
note: this has the same effect as the following command
../windows-default-manifest/configure --host=x86_64-w64-mingw32
--prefix=$PREFIX/x86_64-w64-mingw32
make && make install

9) Build GCC compiler
chdir to build gcc directory and run "make && make install-strip"

4.Now we have a mingw-w64 cross toolchain (without zstd libiconv support)
So we can build canadian toolchain easily

1) Build binutils
../binutils-2.40/configure --disable-nls --disable-rpath --enable-64-bit-bfd
--enable-deterministic-archives --enable-install-libiberty
--host=x86_64-w64-mingw32 --prefix=$PREFIX

2) Build GCC
../gcc-12.2.0/configure --disable-multilib --disable-nls --disable-rpath
--disable-symvers --disable-win32-registry --enable-languages=c,c++,lto
--enable-mingw-wildcard --enable-threads=posix --enable-libgomp
--disable-libstdcxx-verbose --enable-fully-dynamic-string
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=$PREFIX

3) Build mingw-w64, winpthreads and windows default manifest
../mingw-w64-v10.0.0/configure --enable-experimental --disable-lib32
--host=x86_64-w64-mingw32 --prefix=$PREFIX
../mingw-w64-v10.0.0/mingw-w64-libraries/winpthreads/configure
--host=x86_64-w64-mingw32 --prefix=$PREFIX
x86_64-w64-mingw32-windres -F pe-x86-64
./windows-default-manifest/default-manifest.rc -o
install_dir/lib/default-manifest.o

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/101823] GCC generates the wrong string in the assembly code.
  2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
                   ` (4 preceding siblings ...)
  2023-01-19  9:26 ` bootmgr at 163 dot com
@ 2023-01-19  9:27 ` bootmgr at 163 dot com
  2023-01-19  9:31 ` bootmgr at 163 dot com
  2023-01-19  9:40 ` i.nixman at autistici dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bootmgr at 163 dot com @ 2023-01-19  9:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #6 from bootmgr at 163 dot com <bootmgr at 163 dot com> ---
(In reply to niXman from comment #3) 
> what GCC version was used on the host?
$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
11.3.0-1ubuntu1~22.04' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-xKiWfi/gcc-11-11.3.0/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/101823] GCC generates the wrong string in the assembly code.
  2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
                   ` (5 preceding siblings ...)
  2023-01-19  9:27 ` bootmgr at 163 dot com
@ 2023-01-19  9:31 ` bootmgr at 163 dot com
  2023-01-19  9:40 ` i.nixman at autistici dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bootmgr at 163 dot com @ 2023-01-19  9:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #7 from bootmgr at 163 dot com <bootmgr at 163 dot com> ---
(In reply to bootmgr@163.com from comment #5)
> (In reply to niXman from comment #4)
> > please provide the step-by-step instruction you used.
> 1. Extract binutils gcc mingw-w64 files to any where
> Extract gmp mpfr mpc isl to gcc source directory
> note: please make sure no subdirectories are included under
> gcc-x.x.x/{gmp,mpfr,mpc,isl}.
> these file can be found here
> http://ftp.gnu.org/gnu/binutils/
> http://ftp.gnu.org/gnu/gcc/
> https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/
> https://gmplib.org/#DOWNLOAD
> https://www.mpfr.org/mpfr-current/#download
> https://www.multiprecision.org/mpc/download.html
> https://libisl.sourceforge.io/
> 
> 2. Clone the windows default manifest
> (git://cygwin.com/git/cygwin-apps/windows-default-manifest.git)
> 
> 3. These instructions are used to build cross toolchain and install to
> /mingw (can be changed to other directory).
> note: use "make -j$(nproc)" instead "make" to use more CPU cores.
> 
> 1) Set PREFIX and PATH variables
> 
> export PREFIX=/mingw
> export PATH=$PATH:$PREFIX/bin
> note: if you are not root, please run "sudo mkdir /mingw && sudo chmod 777
> /mingw"
> 
> 2) chdir to gcc source directory and run "sed -i
> 's/${prefix}\/mingw\//${prefix}\//g' configure"
> see also
> https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-gcc/
> PKGBUILD#L155
> 
> 3) Build binutils
> ../binutils-2.40/configure --disable-nls --disable-rpath --enable-64-bit-bfd
> --enable-deterministic-archives --enable-install-libiberty
> --target=x86_64-w64-mingw32 --prefix=$PREFIX
> make && make install-strip
> 
> 4) Install mingw-w64 headers
> ../mingw-w64-v10.0.0/mingw-w64-headers/configure --host=x86_64-w64-mingw32
> --prefix=$PREFIX/x86_64-w64-mingw32
> make && make install -j16
> 
> 5) Build GCC core compiler
> ../gcc-12.2.0/configure --disable-multilib --disable-nls --disable-rpath
> --disable-symvers --enable-languages=c,c++,lto --enable-mingw-wildcard
> --enable-threads=posix --enable-libgomp --disable-libstdcxx-verbose
> --enable-fully-dynamic-string --target=x86_64-w64-mingw32 --prefix=$PREFIX
> make all-gcc && make install-strip-gcc
> 
> 6) Build mingw-w64
> ../mingw-w64-v10.0.0/configure --enable-experimental --disable-lib32
> --host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32
> make && make install-strip
> 
> 7) Build winpthreads (pthread support for windows)
> ../mingw-w64-v10.0.0/mingw-w64-libraries/winpthreads/configure
> --host=x86_64-w64-mingw32 --prefix=$PREFIX/x86_64-w64-mingw32
> 
> 8) Build windows default manifest
> x86_64-w64-mingw32-windres -F pe-x86-64
> ./windows-default-manifest/default-manifest.rc -o
> $PREFIX/x86_64-w64-mingw32/lib/default-manifest.o
> note: this has the same effect as the following command
> ../windows-default-manifest/configure --host=x86_64-w64-mingw32
> --prefix=$PREFIX/x86_64-w64-mingw32
> make && make install
> 
> 9) Build GCC compiler
> chdir to build gcc directory and run "make && make install-strip"
> 
> 4.Now we have a mingw-w64 cross toolchain (without zstd libiconv support)
> So we can build canadian toolchain easily
> 
> 1) Build binutils
> ../binutils-2.40/configure --disable-nls --disable-rpath --enable-64-bit-bfd
> --enable-deterministic-archives --enable-install-libiberty
> --host=x86_64-w64-mingw32 --prefix=$PREFIX
> 
> 2) Build GCC
> ../gcc-12.2.0/configure --disable-multilib --disable-nls --disable-rpath
> --disable-symvers --disable-win32-registry --enable-languages=c,c++,lto
> --enable-mingw-wildcard --enable-threads=posix --enable-libgomp
> --disable-libstdcxx-verbose --enable-fully-dynamic-string
> --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=$PREFIX
> 
> 3) Build mingw-w64, winpthreads and windows default manifest
> ../mingw-w64-v10.0.0/configure --enable-experimental --disable-lib32
> --host=x86_64-w64-mingw32 --prefix=$PREFIX
> ../mingw-w64-v10.0.0/mingw-w64-libraries/winpthreads/configure
> --host=x86_64-w64-mingw32 --prefix=$PREFIX
> x86_64-w64-mingw32-windres -F pe-x86-64
> ./windows-default-manifest/default-manifest.rc -o
> install_dir/lib/default-manifest.o
After a loooog compile, I get the same error on my Ubuntu WSL. but I think it
might be a problem with the WSL VM.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug target/101823] GCC generates the wrong string in the assembly code.
  2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
                   ` (6 preceding siblings ...)
  2023-01-19  9:31 ` bootmgr at 163 dot com
@ 2023-01-19  9:40 ` i.nixman at autistici dot org
  7 siblings, 0 replies; 9+ messages in thread
From: i.nixman at autistici dot org @ 2023-01-19  9:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101823

--- Comment #8 from niXman <i.nixman at autistici dot org> ---
(In reply to bootmgr@163.com from comment #7)

> After a loooog compile, I get the same error on my Ubuntu WSL. but I think
> it might be a problem with the WSL VM.

there is nothing unusual in your instruction except of WSL. try to rebuild it
in linux host, or even on a real VM.

because I've build a MinGW cross compiler many times but I've never seen
anything like it.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-01-19  9:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09  5:57 [Bug c++/101823] New: GCC generates the wrong string in the assembly code bootmgr at 163 dot com
2021-08-09  5:57 ` [Bug c++/101823] " bootmgr at 163 dot com
2021-08-12 22:11 ` [Bug target/101823] " bootmgr at 163 dot com
2023-01-17 19:15 ` i.nixman at autistici dot org
2023-01-17 19:18 ` i.nixman at autistici dot org
2023-01-19  9:26 ` bootmgr at 163 dot com
2023-01-19  9:27 ` bootmgr at 163 dot com
2023-01-19  9:31 ` bootmgr at 163 dot com
2023-01-19  9:40 ` i.nixman at autistici dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).