[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-26 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

--- Comment #10 from Xi Ruoyao  ---
(In reply to Xi Ruoyao from comment #9)
> (In reply to Andrew Pinski from comment #7)
> > If you compile GMP (MPFR and MPC) as part of GCC build rather than
> > seperately, the build will do the correct thing and not use the "native"
> > options by default.
> > 
> > 
> > You could also configure GMP using --target=none-linux-gnu
> > --host=none-linux-gnu --build=none-linux-gnu to disable that similar thing
> > (just as building GMP as part of GCC's build).
> > 
> > From Makefile.def:
> > host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
> > // Work around in-tree gmp configure bug with missing flex.
> > extra_configure_flags='--disable-shared LEX="touch lex.yy.c"
> > @host_libs_picflag@';
> > extra_make_flags='AM_CFLAGS="-DNO_ASM"';
> > no_install= true;
> > // none-*-* disables asm optimizations, bootstrap-testing
> > // the compiler more thoroughly.
> > host="none-${host_vendor}-${host_os}";
> > // gmp's configure will complain if given anything
> > // different from host for target.
> > target="none-${host_vendor}-${host_os}"; };
> 
> FWIW when I try this, configure script says:
> 
> configure: WARNING: the "none" host is obsolete, use --disable-assembly
> 
> So I'll change the LFS book to use --disable-assembly instead of these fancy
> "cp configfsf" things.  Not sure if we should use --disable-assembly too for
> GCC in-tree GMP (I don't know which the first version of GMP supports
> --disable-assembly).

Nope, --disable-assembly still sets CFLAGS to -march=nehalem.  So the configure
script is lying :(.

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-26 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

--- Comment #9 from Xi Ruoyao  ---
(In reply to Andrew Pinski from comment #7)
> If you compile GMP (MPFR and MPC) as part of GCC build rather than
> seperately, the build will do the correct thing and not use the "native"
> options by default.
> 
> 
> You could also configure GMP using --target=none-linux-gnu
> --host=none-linux-gnu --build=none-linux-gnu to disable that similar thing
> (just as building GMP as part of GCC's build).
> 
> From Makefile.def:
> host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
> // Work around in-tree gmp configure bug with missing flex.
> extra_configure_flags='--disable-shared LEX="touch lex.yy.c"
> @host_libs_picflag@';
> extra_make_flags='AM_CFLAGS="-DNO_ASM"';
> no_install= true;
> // none-*-* disables asm optimizations, bootstrap-testing
> // the compiler more thoroughly.
> host="none-${host_vendor}-${host_os}";
> // gmp's configure will complain if given anything
> // different from host for target.
> target="none-${host_vendor}-${host_os}"; };

FWIW when I try this, configure script says:

configure: WARNING: the "none" host is obsolete, use --disable-assembly

So I'll change the LFS book to use --disable-assembly instead of these fancy
"cp configfsf" things.  Not sure if we should use --disable-assembly too for
GCC in-tree GMP (I don't know which the first version of GMP supports
--disable-assembly).

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-26 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

Xi Ruoyao  changed:

   What|Removed |Added

 CC||xry111 at gcc dot gnu.org

--- Comment #8 from Xi Ruoyao  ---
For LFS specific issue please ask lfs-supp...@lists.linuxfromscratch.org first. 

If you'd done so you'd avoid a unnecessary two-day debug session and we'd
reduce one invalid bug report in upstream issue tracker.

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-26 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

Andrew Pinski  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #7 from Andrew Pinski  ---
If you compile GMP (MPFR and MPC) as part of GCC build rather than seperately,
the build will do the correct thing and not use the "native" options by
default.


You could also configure GMP using --target=none-linux-gnu
--host=none-linux-gnu --build=none-linux-gnu to disable that similar thing
(just as building GMP as part of GCC's build).

>From Makefile.def:
host_modules= { module= gmp; lib_path=.libs; bootstrap=true;
// Work around in-tree gmp configure bug with missing flex.
extra_configure_flags='--disable-shared LEX="touch lex.yy.c"
@host_libs_picflag@';
extra_make_flags='AM_CFLAGS="-DNO_ASM"';
no_install= true;
// none-*-* disables asm optimizations, bootstrap-testing
// the compiler more thoroughly.
host="none-${host_vendor}-${host_os}";
// gmp's configure will complain if given anything
// different from host for target.
target="none-${host_vendor}-${host_os}"; };

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-26 Thread pledr at gmx dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

--- Comment #6 from Peter Lezoch  ---


In the passed days, I have further investigated the issue:

  the backtrace leads to: 0xba137d real_from_string(real_value*, char const*)
../../gcc/real.cc:2110  which is the following line
of code:

-->inexact = mpfr_strtofr (m, str, NULL, 10,
MPFR_RNDZ);

--> MPFR -- GNU Multiple Precision Floating-Point
Reliable Library

  so I rebuilt mpfr-4.2.0  and found in the configure step a strong connection
to

--> GMP -- GNU Multiple Precision Arithmetic
Library (GMP)

  In
https://www.linuxfromscratch.org/lfs/view/stable-systemd/chapter08/gmp.html
  I found TWO remarkable NOTEs:

--
   Note

The default settings of GMP produce libraries optimized for the host processor.
If libraries suitable for processors less capable than the host's CPU are
desired, generic libraries can be created by running the following:

cp -v configfsf.guess config.guess
cp -v configfsf.sub   config.sub

--

and

--

 Caution

The code in gmp is highly optimized for the processor where it is built.
Occasionally, the code that detects the processor misidentifies the system
capabilities and there will be errors in the tests or other applications using
the gmp libraries with the message "Illegal instruction". In this case, gmp
should be reconfigured with the option --build=x86_64-pc-linux-gnu and rebuilt.

--

BINGO 

So rebuilding of gmp-6.2.1 with above options and precautions and
   rebuilding of mpfr-42.0 and
   rebuilding of gcc-12.2 without --disable-avx2

solved all the observed issues !!




So thanks to all for there efforts !
>From my point of view the Bug 110789 is solved and can be closed !!!

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-24 Thread pledr at gmx dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

--- Comment #5 from Peter Lezoch  ---
I built a new gcc with --disable-avx2:

bash-5.2# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr --disable-avx2
--enable-multilib --with-multili
b-list=m64,m32,mx32 --with-system-zlib --enable-default-pie
--enable-default-ssp --with-lon
g-double-128 --enable-languages=c,c++,fortran
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC)
bash-5.2#

BUT: get the same internal error

     ==>> no improvement !!!


On 2023-07-24 10:55, pinskia at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789
>
> Andrew Pinski  changed:
>
> What|Removed |Added
> 
>   Status|UNCONFIRMED |WAITING
>   Ever confirmed|0   |1
> Last reconfirmed||2023-07-24
>
> --- Comment #1 from Andrew Pinski  ---
> How did you configure gcc?
>
> I suspect the issue is you compiled gcc to only run on the first machine which
> has avx2 while the second one does not.
>

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-24 Thread pledr at gmx dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

--- Comment #4 from Peter Lezoch  ---
I have a complete buildLog and there is NO  -march=native

I'm just rebuilding now with --disable-avx2

Have to build on R9 because on Zeut gcc reports 'internal error' again !!!





On 2023-07-24 11:04, arsen at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789
>
> Arsen Arsenović  changed:
>
> What|Removed |Added
> 
>   CC||arsen at gcc dot gnu.org
>
> --- Comment #3 from Arsen Arsenović  ---
> did you happen to se -march=native in CFLAGS or such when building gcc?
>

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-24 Thread arsen at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

Arsen Arsenović  changed:

   What|Removed |Added

 CC||arsen at gcc dot gnu.org

--- Comment #3 from Arsen Arsenović  ---
did you happen to se -march=native in CFLAGS or such when building gcc?

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-24 Thread pledr at gmx dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

Peter Lezoch  changed:

   What|Removed |Added

  Attachment #55617|0   |1
is obsolete||

--- Comment #2 from Peter Lezoch  ---
Created attachment 55618
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55618=edit
gcc -v

bash-5.2# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr LD=ld --enable-languages=c,c++
--enable-default-pie --enable-default-ssp --enable-multilib
--with-multilib-list=m64,m32,mx32 --disable-bootstrap --with-system-zlib
--with-long-double-128
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC) 
bash-5.2#

[Bug c/110789] Internal Compiler Error: Illegal instruction

2023-07-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110789

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
 Ever confirmed|0   |1
   Last reconfirmed||2023-07-24

--- Comment #1 from Andrew Pinski  ---
How did you configure gcc?

I suspect the issue is you compiled gcc to only run on the first machine which
has avx2 while the second one does not.