[Bug target/113715] RISC-V: If the Zcmp is enabled, the a0 register operates abnormally when the program returns

2024-02-07 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113715

--- Comment #3 from Huaqi  ---
(In reply to Andrew Pinski from comment #2)
> Yes this is where shrink wrapping incorrects incorrectly with
> riscv_zcmp_can_use_popretz optimization. Basically popretz should be
> disabled for shrink wrapped function call I think ...

Maybe just revert this commit is a good approach for now, it won't affect other
functions, and later on someone upload new patch to implement this cm.popretz
generation

[Bug target/113715] RISC-V: If the Zcmp is enabled, the a0 register operates abnormally when the program returns

2024-02-05 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113715

Huaqi  changed:

   What|Removed |Added

 CC||fanghuaqi at vip dot qq.com

--- Comment #1 from Huaqi  ---
I tried to revert this commit
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b27d323a368033f0b37e93c57a57a35fd9997864

Then the wrong generated cm.popretz is removed, and it now works as expected,
could somebody check whether there is a better solution to this patch.

Thanks

[Bug target/112537] Is there a way to disable cpymem pass for rvv

2023-11-14 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112537

--- Comment #5 from Huaqi  ---
(In reply to JuzheZhong from comment #4)
> You mean you want to disable it when disabling auto-vectorization ?

Yes, I think this could be better, so we can control whether vector instruction
should be generated, and if auto generated rvv instruction is not good, we can
enable it via gcc pragma control for selected code block.

Thanks

[Bug target/112537] Is there a way to disable cpymem pass for rvv

2023-11-14 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112537

--- Comment #3 from Huaqi  ---
Hi Juzhe, thanks for the help, could it be controlled by
--param=riscv-autovec-preference= option, so if I want to enable cpymem
optimization, I can enable it by auto vectorzation.

Thanks

[Bug c/112537] New: Is there a way to disable cpymem pass for rvv

2023-11-14 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112537

Bug ID: 112537
   Summary: Is there a way to disable cpymem pass for rvv
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fanghuaqi at vip dot qq.com
  Target Milestone: ---

See
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/testsuite/gcc.target/riscv/rvv/base/cpymem-2.c;h=7b706b6ef52544cabdce2007256c9e67b72ccd79;hb=9464e72bcc9123b619215af8cfef491772a3ebd9
this case, if I pass -march=rv64imafdcv to compile code like this, it will
generate vector related code, which I think it should only be enabled when
--param=riscv-autovec-preference=scalable is enabled, but actually it is auto
enable d even I pass  --param=riscv-autovec-preference=none, see
https://godbolt.org/z/TazWKEjzM

Is there a way to disable it, since if vector load and store for smaller
structure assign is costable and harmfull to cpu pipeline.

Thanks

[Bug target/111927] RISC-V: internal compiler error: in merge, at config/riscv/riscv-vsetvl.cc:1997

2023-10-23 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111927

Huaqi  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Huaqi  ---
Yes, I tried with latest commit
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=0c4bd1321a6def5eb44c530e83b01a415633b660,
it works now.

[Bug target/111927] RISC-V: internal compiler error: in merge, at config/riscv/riscv-vsetvl.cc:1997

2023-10-23 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111927

--- Comment #2 from Huaqi  ---
(In reply to JuzheZhong from comment #1)
> Confirm VSETVL PASS issue.
> 
> We just refactored it recently.
> 
> I will fix it. Thanks for report it.

Thanks for your reply, wait for the refactorization finished.

[Bug target/111927] New: RISC-V: internal compiler error: in merge, at config/riscv/riscv-vsetvl.cc:1997

2023-10-23 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111927

Bug ID: 111927
   Summary: RISC-V: internal compiler error: in merge, at
config/riscv/riscv-vsetvl.cc:1997
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fanghuaqi at vip dot qq.com
  Target Milestone: ---

Created attachment 56173
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56173=edit
bug file compiled by risc-v rvv compiler

Hi, I met an issue when compile code attached using risc-v gcc
compiler(-march=rv64imafc_zve64f  -mabi=lp64f -O2) from master branch, and it
throw issue like below:

during RTL pass: vsetvl
: In function 'riscv_lms_f32':
:240:1: internal compiler error: in merge, at
config/riscv/riscv-vsetvl.cc:1997
  240 | }
  | ^
0x7ff32c9c0082 __libc_start_main
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.
Compiler returned: 1

Checked with gcc 13.2.0 and clang truck it both works well.

You can also check it in https://godbolt.org/z/4drnazzaf

[Bug bootstrap/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-12 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #35 from Huaqi  ---
OK, thanks

[Bug bootstrap/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-12 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #25 from Huaqi  ---
Hi here is what I tested in Ubuntu 18.04

root@1aae7bc8a1f6:/work/LocalBuilds/2023.04-eng2_20230412_014350/build-gcc-newlib-stage1/gcc#
i686-w64-mingw32-gcc -nostdlib -r utf8rc-mingw32.o sym-mingw32.o -o
utf8-mingw32.o
root@1aae7bc8a1f6:/work/LocalBuilds/2023.04-eng2_20230412_014350/build-gcc-newlib-stage1/gcc#
i686-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/7.3-win32/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr
--includedir='/usr/include' --mandir='/usr/share/man'
--infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var
--disable-silent-rules --libdir='/usr/lib/x86_64-linux-gnu'
--libexecdir='/usr/lib/x86_64-linux-gnu' --disable-maintainer-mode
--disable-dependency-tracking --prefix=/usr --enable-shared --enable-static
--disable-multilib --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes
--with-tune=generic --with-headers=/usr/i686-w64-mingw32/include
--enable-version-specific-runtime-libs --enable-fully-dynamic-string
--enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto
--with-plugin-ld --enable-threads=win32 --program-suffix=-win32
--program-prefix=i686-w64-mingw32- --target=i686-w64-mingw32
--with-as=/usr/bin/i686-w64-mingw32-as --with-ld=/usr/bin/i686-w64-mingw32-ld
--enable-libatomic --enable-libstdcxx-filesystem-ts=yes
Thread model: win32
gcc version 7.3-win32 20180312 (GCC)
root@1aae7bc8a1f6:/work/LocalBuilds/2023.04-eng2_20230412_014350/build-gcc-newlib-stage1/gcc#
i686-w64-mingw32-objdump -t utf8-mingw32.o|grep -i startup
root@1aae7bc8a1f6:/work/LocalBuilds/2023.04-eng2_20230412_014350/build-gcc-newlib-stage1/gcc#

gcc 7.2 with -r works for me.

Thanks

[Bug bootstrap/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-12 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #22 from Huaqi  ---
(In reply to Eric Botcazou from comment #20)
> Can you add -nostdlib alongside -r in the command?

Hi, I have tried this, it works.

[Bug bootstrap/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-12 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #21 from Huaqi  ---
Hi, I tried to change it like this


$ git diff
diff --git a/gcc/config/i386/x-mingw32-utf8 b/gcc/config/i386/x-mingw32-utf8
index 2783dd259a6..e4a6c7f3d3a 100644
--- a/gcc/config/i386/x-mingw32-utf8
+++ b/gcc/config/i386/x-mingw32-utf8
@@ -34,7 +34,7 @@ utf8rc-mingw32.o : $(srcdir)/config/i386/utf8-mingw32.rc \
 # Create an object file that just exports the global symbol
 # HOST_EXTRA_OBJS_SYMBOL
 sym-mingw32.o : $(srcdir)/config/i386/sym-mingw32.cc
-   $(COMPILER) -c $< $@
+   $(COMPILER) -c $<

 # Combine the two object files into one which has both the
 # compiled utf8 resource and the HOST_EXTRA_OBJS_SYMBOL symbol.
@@ -45,7 +45,7 @@ sym-mingw32.o : $(srcdir)/config/i386/sym-mingw32.cc
 # get linked into the compiler proper eventually.
 # Therefore we need to request the symbol at compiler link time.
 utf8-mingw32.o : utf8rc-mingw32.o sym-mingw32.o
-   $(COMPILER) -r utf8rc-mingw32.o sym-mingw32.o -o $@
+   $(COMPILER) -r -nostdlib utf8rc-mingw32.o sym-mingw32.o -o $@


It seems to works for me now.

[Bug bootstrap/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-12 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #17 from Huaqi  ---
Hi, I have apply this patch, but it failed like what I do before.


libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a 
-L/work/LocalBuilds/2023.04-eng2_20230412_014350/build-gcc-newlib-stage1/./isl/.libs
 -lisl
-L/work/LocalBuilds/2023.04-eng2_20230412_014350/build-gcc-newlib-stage1/./gmp/.libs
-L/work/LocalBuilds/2023.04-eng2_20230412_014350/build-gcc-newlib-stage1/./mpfr/src/.libs
-L/work/LocalBuilds/2023.04-eng2_20230412_014350/build-gcc-newlib-stage1/./mpc/src/.libs
-lmpc -lmpfr -lgmp   -lz -lzstd
utf8-mingw32.o: In function `WinMainCRTStartup':
./mingw-w64-crt/crt/crtexe.c:171: multiple definition of `WinMainCRTStartup'
/usr/lib/gcc/i686-w64-mingw32/7.3-win32/../../../../i686-w64-mingw32/lib/../lib/crt2.o:./mingw-w64-crt/crt/crtexe.c:171:
first defined here
utf8-mingw32.o: In function `mainCRTStartup':
./mingw-w64-crt/crt/crtexe.c:199: multiple definition of `mainCRTStartup'
/usr/lib/gcc/i686-w64-mingw32/7.3-win32/../../../../i686-w64-mingw32/lib/../lib/crt2.o:./mingw-w64-crt/crt/crtexe.c:199:
first defined here
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1684826487) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1685024119) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (6644847) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1414356820) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1230261845) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1599555406) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 117.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1599555406) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1230261845) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1414356820) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 97.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (6644847) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 110.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1685024119) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 110.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1684826487) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 110.
utf8-mingw32.o:cygming-crtbegin.c:(.text+0x500): multiple definition of
`__gcc_register_frame'
/usr/lib/gcc/i686-w64-mingw32/7.3-win32/crtbegin.o:cygming-crtbegin.c:(.text+0x0):
first defined here
utf8-mingw32.o:cygming-crtbegin.c:(.text+0x520): multiple definition of
`__gcc_deregister_frame'
/usr/lib/gcc/i686-w64-mingw32/7.3-win32/crtbegin.o:cygming-crtbegin.c:(.text+0x20):
first defined here
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1599555406) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1230261845) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1414356820) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 97.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (6644847) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 110.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to 

[Bug bootstrap/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-12 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #15 from Huaqi  ---
Hello, this is the version I am using.

OS environment: 
root@1aae7bc8a1f6:/work# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.6 LTS"

packages installed


binutils-mingw-w64-i686/bionic,now 2.30-7ubuntu1+8ubuntu1 amd64 [installed]
g++-mingw-w64-i686/bionic,now 7.3.0-11ubuntu1+20.2build1 amd64 [installed]
gcc-mingw-w64-i686/bionic,now 7.3.0-11ubuntu1+20.2build1 amd64 [installed]
mingw-w64-i686-dev/bionic,now 5.0.3-1 all [installed,automatic]



root@1aae7bc8a1f6:/work# make -v
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
root@1aae7bc8a1f6:/work# i686-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/7.3-win32/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr
--includedir='/usr/include' --mandir='/usr/share/man'
--infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var
--disable-silent-rules --libdir='/usr/lib/x86_64-linux-gnu'
--libexecdir='/usr/lib/x86_64-linux-gnu' --disable-maintainer-mode
--disable-dependency-tracking --prefix=/usr --enable-shared --enable-static
--disable-multilib --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes
--with-tune=generic --with-headers=/usr/i686-w64-mingw32/include
--enable-version-specific-runtime-libs --enable-fully-dynamic-string
--enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto
--with-plugin-ld --enable-threads=win32 --program-suffix=-win32
--program-prefix=i686-w64-mingw32- --target=i686-w64-mingw32
--with-as=/usr/bin/i686-w64-mingw32-as --with-ld=/usr/bin/i686-w64-mingw32-ld
--enable-libatomic --enable-libstdcxx-filesystem-ts=yes
Thread model: win32
gcc version 7.3-win32 20180312 (GCC)
root@1aae7bc8a1f6:/work# i686-w64-mingw32-ld -v
GNU ld (GNU Binutils) 2.30


I have upload the docker image I am using to
https://hub.docker.com/r/nucleisoftware/gnutoolchain-ubuntu18.04

Thanks

[Bug bootstrap/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-11 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #13 from Huaqi  ---
Hello, I didn't take a try with other mingw gcc version, locally I just revert
304c7d44a2212e6fd618587331cea2c266dc10bf commit, then it works for me.

Thanks
Huaqi

[Bug bootstrap/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-11 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #12 from Huaqi  ---
Hello, this is the command used to configure gcc

/work/gcc/configure --target=riscv64-unknown-elf --host=i686-w64-mingw32
--prefix=/work/LocalInstall/win32/newlibc/2023.04-eng2/gcc --disable-shared
--di
sable-threads --enable-languages=c,c++ --with-pkgversion=g465fcab6ea9
--with-system-zlib --enable-tls --with-newlib
--with-sysroot=/work/LocalInstall/win32/n
ewlibc/2023.04-eng2/gcc/riscv64-unknown-elf
--with-native-system-header-dir=/include --disable-libmudflap --disable-libssp
--disable-libquadmath --disable-li
bgomp --disable-nls --disable-tm-clone-registry --src=/work/gcc
--enable-multilib
--with-multilib-generator=rv32emc-ilp32e--;rv32emac-ilp32e--;rv32imc-ilp32-
-;rv32imac-ilp32--;rv32imafc-ilp32f--;rv32imafdc-ilp32d--;rv32imac_zba_zbb_zbc_zbs-ilp32--;rv32imafc_zba_zbb_zbc_zbs-ilp32f--;rv32imafdc_zba_zbb_zbc_zbs-ilp3
2d--;rv64imac-lp64--;rv64imafc-lp64f--;rv64imafdc-lp64d--;rv64imac_zba_zbb_zbc_zbs-lp64--;rv64imafc_zba_zbb_zbc_zbs-lp64f--;rv64imafdc_zba_zbb_zbc_zbs-lp64d-
-; --with-abi=lp64 --with-arch=rv64ima --with-tune=rocket --with-isa-spec=2.2
CFLAGS_FOR_TARGET=-Os   -mcmodel=medany CXXFLAGS_FOR_TARGET=-Os   -mcmodel=meda
ny

and then do command below

make

[Bug c/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-11 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #9 from Huaqi  ---
Hi, Costas Argyris,

I am using this repo to help build toolchain, the repo link is here:

https://github.com/riscv-collab/riscv-gnu-toolchain

clone this source code and its submodule, and change gcc to upstream version

git clone https://github.com/riscv-collab/riscv-gnu-toolchain.git
git submodule update --init --recursive --depth 1
cd gcc
# fetch upstream gcc source code
git fetch --all
git checkout master
cd ..

Tested in Ubuntu 18.04, with packages binutils-mingw-w64-i686
gcc-mingw-w64-i686 g++-mingw-w64-i686 binutils-mingw-w64-i686 installed and
other requirements in
https://github.com/riscv-collab/riscv-gnu-toolchain#prerequisites.


build command:

mkdir build
cd build
../configure --prefix=$(pwd)/install --with-host=i686-w64-mingw32 
--enable-multilib
make -j16

Then you will be able to reproduce this issue.

Thanks

[Bug c/109460] Build gcc for win32 failed in gcc13 master branch

2023-04-10 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

--- Comment #6 from Huaqi  ---
I think it might be introduced by this commit
https://github.com/gcc-mirror/gcc/commit/304c7d44a2212e6fd618587331cea2c266dc10bf,
since I tested this commit
https://github.com/gcc-mirror/gcc/commit/4872e46e080c6695dfe1f9dc9db26b4703bc348c
it works for win32 build. After this commit, it failed.

[Bug bootstrap/109461] build gcc for riscv target failed with `execvp: /bin/sh: Argument list too long error when using with --with-multilib-generator`

2023-04-09 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109461

--- Comment #3 from Huaqi  ---
Thanks Kito, maybe you can add more examples in this script
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/riscv/multilib-generator
and in this doc
https://github.com/riscv-collab/riscv-gnu-toolchain#build-with-customized-multi-lib-configure.

Thank you very much.

[Bug c/109461] New: build gcc for riscv target failed with `execvp: /bin/sh: Argument list too long error when using with --with-multilib-generator`

2023-04-09 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109461

Bug ID: 109461
   Summary: build gcc for riscv target failed with `execvp:
/bin/sh: Argument list too long error when using with
--with-multilib-generator`
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fanghuaqi at vip dot qq.com
  Target Milestone: ---

Hi there, I am using gcc master branch source code(gcc 13), and tried to use
this repo https://github.com/riscv-collab/riscv-gnu-toolchain to cross build
toolchain for riscv target with multilib enabled, the multilib configuration is
as below



--with-multilib-generator="rv32emc-ilp32e--;rv32emac-ilp32e--;rv32imc-ilp32--;rv32imac-ilp32--zfh*zfhmin*zve32x;rv32imafc-ilp32f--zfh*zfhmin*zve32f;rv32imafdc-ilp32d--zfh*zfhmin*zve32f;rv32imac_zba_zbb_zbc_zbs-ilp32--zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32x;rv32imafc_zba_zbb_zbc_zbs-ilp32f--zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32f;rv32imafdc_zba_zbb_zbc_zbs-ilp32d--zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32f;rv32ima_zca_zcb_zcmp_zcmt-ilp32--zfh*zfhmin*zve32x;rv32imaf_zca_zcb_zcf_zcmp_zcmt-ilp32f--zfh*zfhmin*zve32f;rv32imafd_zca_zcb_zcf_zcd-ilp32d--zfh*zfhmin*zve32f;rv32ima_zca_zcb_zcmp_zcmt_zba_zbb_zbc_zbs-ilp32--zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32x;rv32imaf_zca_zcb_zcf_zcmp_zcmt_zba_zbb_zbc_zbs-ilp32f--zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32f;rv32imafd_zca_zcb_zcf_zcd_zba_zbb_zbc_zbs-ilp32d--zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32f;rv32imac_xxldsp-ilp32--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zve32x;rv32imafc_xxldsp-ilp32f--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zve32f;rv32imafdc_xxldsp-ilp32d--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zve32f;rv32imaczba_zbb_zbc_zbs_xxldsp-ilp32--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32x;rv32imafc_zba_zbb_zbc_zbs_xxldsp-ilp32f--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32f;rv32imafdc_zba_zbb_zbc_zbs_xxldsp-ilp32d--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32f;rv32ima_zca_zcb_zcmp_zcmt_xxldsp-ilp32--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zve32x;rv32imaf_zca_zcb_zcf_zcmp_zcmt_xxldsp-ilp32f--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zve32f;rv32imafd_zca_zcb_zcf_zcd_xxldsp-ilp32d--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zve32f;rv32ima_zca_zcb_zcmp_zcmt_zba_zbb_zbc_zbs_xxldsp-ilp32--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32x;rv32imaf_zca_zcb_zcf_zcmp_zcmt_zba_zbb_zbc_zbs_xxldsp-ilp32f--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32f;rv32imafd_zca_zcb_zcf_zcd_zba_zbb_zbc_zbs_xxldsp-ilp32d--xxldspn1*xxldspn2*xxldspn3*zfh*zfhmin*zbkb_zbkc_zbkx_zk*zve32f;rv64imac-lp64--xxldsp*xxldspn1*zfhmin*zfh*v;rv64imafc-lp64f--xxldsp*xxldspn1*zfhmin*zfh*v;rv64imafdc-lp64d--xxldsp*xxldspn1*zfhmin*zfh*v;rv64imac_zba_zbb_zbc_zbs-lp64--xxldsp*xxldspn1*zfhmin*zfh*zbkb_zbkc_zbkx_zk*v;rv64imafc_zba_zbb_zbc_zbs-lp64f--xxldsp*xxldspn1*zfhmin*zfh*zbkb_zbkc_zbkx_zk*v;rv64imafdc_zba_zbb_zbc_zbs-lp64d--xxldsp*xxldspn1*zfhmin*zfh*zbkb_zbkc_zbkx_zk*v;rv64ima_zca_zcb_zcmp_zcmt-lp64--xxldsp*xxldspn1*zfhmin*zfh*v;rv64imaf_zca_zcb_zcf_zcmp_zcmt-lp64f--xxldsp*xxldspn1*zfhmin*zfh*v;rv64imafd_zca_zcb_zcf_zcd-lp64d--xxldsp*xxldspn1*zfhmin*zfh*v;rv64ima_zca_zcb_zcmp_zcmt_zba_zbb_zbc_zbs-lp64--xxldsp*xxldspn1*zfhmin*zfh*zbkb_zbkc_zbkx_zk*v;rv64imaf_zca_zcb_zcf_zcmp_zcmt_zba_zbb_zbc_zbs-lp64f--xxldsp*xxldspn1*zfhmin*zfh*zbkb_zbkc_zbkx_zk*v;rv64imafd_zca_zcb_zcf_zcd_zba_zbb_zbc_zbs-lp64d--xxldsp*xxldspn1*zfhmin*zfh*zbkb_zbkc_zbkx_zk*v"


But when I build the toolchain, it will fail with the following messsage


if test yes = yes \
   || test -n ""; then \
  /bin/sh /work/gcc/gcc/genmultilib \
.. too long to show, ignore it .
_zbs_zve32f_zve32x_zve64d_zve64f_zve64x_zvl128b_zvl32b_zvl64b_xxldsp/mabi.lp64d
march.rv64imafd_zca_zcb_zcd_zcf_zba_zbb_zbc_zbs/mabi.lp64d=march.rv64imafdv_zfhmin_zca_zcb_zcd_zcf_zba_zbb_zbc_zbs_zve32f_zve32x_zve64d_zve64f_zve64x_zvl128b_zvl32b_zvl64b_xxldsp_xxldspn1/mabi.lp64d
march.rv64imafd_zca_zcb_zcd_zcf_zba_zbb_zbc_zbs/mabi.lp64d=march.rv64imafdv_zfhmin_zca_zcb_zcd_zcf_zba_zbb_zbc_zbs_zve32f_zve32x_zve64d_zve64f_zve64x_zvl128b_zvl32b_zvl64b_xxldspn1/mabi.lp64d"
\
"yes" \
> tmp-mlib.h; \
else \
  /bin/sh /work/gcc/gcc/genmultilib '' '' '' '' '' '' '' '' \
"" '' no \
> tmp-mlib.h; \
fi
make[2]: execvp: /bin/sh: Argument list too long
make[2]: *** [Makefile:2252: s-mlib] Error 127

For more details, you can check in
https://github.com/riscv-collab/riscv-gnu-toolchain/issues/1226, and others can
repeat this issue.

Thanks for any help you could provide.

[Bug c/109460] New: Build gcc for win32 failed in gcc13 master branch

2023-04-09 Thread fanghuaqi at vip dot qq.com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109460

Bug ID: 109460
   Summary: Build gcc for win32 failed in gcc13 master branch
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fanghuaqi at vip dot qq.com
  Target Milestone: ---

Hi there, I tried to build gcc 13 for windows host using mingw gcc in linux.
But I am facing the following issue.

i686-w64-mingw32-g++  -fno-PIE -c /work/gcc/gcc/config/i386/sym-mingw32.cc
sym-mingw32.o
i686-w64-mingw32-g++: error: sym-mingw32.o: No such file or directory
echo timestamp > s-bversion

It seems the sym-mingw32.o is not generated via this command, and I thought it
should be like gcc -c hello.c -o hello.o, so I changed
gcc/config/i386/x-mingw32-utf8

diff --git a/gcc/config/i386/x-mingw32-utf8 b/gcc/config/i386/x-mingw32-utf8
index 2783dd259a6..b008497ca0b 100644
--- a/gcc/config/i386/x-mingw32-utf8
+++ b/gcc/config/i386/x-mingw32-utf8
@@ -34,7 +34,7 @@ utf8rc-mingw32.o : $(srcdir)/config/i386/utf8-mingw32.rc \
 # Create an object file that just exports the global symbol
 # HOST_EXTRA_OBJS_SYMBOL
 sym-mingw32.o : $(srcdir)/config/i386/sym-mingw32.cc
-   $(COMPILER) -c $< $@
+   $(COMPILER) -c $< -o $@

This issue disappeared, but other issue like this happened, I didn't have ideas
to  how to fix it.

utf8-mingw32.o: In function `WinMainCRTStartup':
./mingw-w64-crt/crt/crtexe.c:171: multiple definition of `WinMainCRTStartup'
/usr/lib/gcc/i686-w64-mingw32/7.3-win32/../../../../i686-w64-mingw32/lib/../lib/crt2.o:./mingw-w64-crt/crt/crtexe.c:171:
first defined here
utf8-mingw32.o: In function `mainCRTStartup':
./mingw-w64-crt/crt/crtexe.c:199: multiple definition of `mainCRTStartup'
/usr/lib/gcc/i686-w64-mingw32/7.3-win32/../../../../i686-w64-mingw32/lib/../lib/crt2.o:./mingw-w64-crt/crt/crtexe.c:199:
first defined here
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1684826487) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1685024119) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (6644847) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1414356820) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1230261845) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1599555406) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 117.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1599555406) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1230261845) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1414356820) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 97.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (6644847) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 110.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1685024119) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 110.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (1684826487) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset (7496040) greater than or
equal to .debug_line size (9993).
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 101.
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Could not find abbrev number 110.
utf8-mingw32.o:cygming-crtbegin.c:(.text+0x500): multiple definition of
`__gcc_register_frame'
/usr/lib/gcc/i686-w64-mingw32/7.3-win32/crtbegin.o:cygming-crtbegin.c:(.text+0x0):
first defined here
utf8-mingw32.o:cygming-crtbegin.c:(.text+0x520): multiple definition of
`__gcc_deregister_frame'
/usr/lib/gcc/i686-w64-mingw32/7.3-win32/crtbegin.o:cygming-crtbegin.c:(.text+0x20):
first defined here
/usr/bin/i686-w64-mingw32-ld: Dwarf Error: Offset