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

            Bug ID: 96387
           Summary: gnu gmp c source edit g++ internal compiler error
                    appear
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cents2823 at yahoo dot co.jp
  Target Milestone: ---

Gnu gmp c source edit and configure, make, make check, make install.
Modified link change to enable gnu gmp executive.
(ln -nfs /usr/local/lib/libgmp.so.10.4.0
/usr/lib/x86_64-linux-gnu/libgmp.so.10)
I get the following gcc error. G++ compilation is normal before link change.
As shown in #3, the same error occurs even if G++ uninstall install.
Therefore, it seems that the cause is that the data referenced by g++ has
changed. Where is the data referenced by gcc?
Gnu gmp changes are shown in #4. This change is necessary to make the integer
more than 40 billion digits.
#5 shows g++ -v.

Thanking you in advance.
Frome:Tsukamoto

#include <stdio.h>
#include "math.h"

int main(void) {        
        float y = 0.1;
        printf("\ny= %5.2f",y);

/* #1   
        tsuka@tsuka-n:~/pi64$ g++ test_g++l.c -o test_g++l01
        tsuka@tsuka-n:~/pi64$ gcc test_g++l.c -o test_g++l01    

        printf float %f become this error mesege but %d etc is OK
        during GIMPLE pass: printf-return-value
        test_g++.c: In function ‘int main()’:
        test_g++.c:4:5: internal compiler error: Segmentation fault
           4 | int main(void) {
             |     ^~~~
        Please submit a full bug report,
        with preprocessed source if appropriate.
        See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
*/

        long long int pidw64s = 1000;
        long long int lpi10 = (long long int)((log(2) * 64 * pidw64s) /
log(10));

/* #2   
        tsuka@tsuka-n:~/pi64$ g++ test_g++.c -o test_g++01

       The above statement became error
        test_g++.c: In function ‘int main()’:
        test_g++.c:15:44:   in ‘constexpr’ expansion of ‘std::log<int>(2)’
        test_g++.c:15:50: internal compiler error: Segmentation fault
           22 |  long long int lpi10 = (long long int)((log(2) * 64 * pidw64s)
/ log(10));
              |                                                  ^~
        Please submit a full bug report,
        with preprocessed source if appropriate.
        See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.


        tsuka@tsuka-n:~/pi64$ gcc test_g++.c -o test_g++01
        test_g++.c: In function ‘main’:
        test_g++.c:23:2: internal compiler error: Segmentation fault
           23 |  long long int lpi10 = (long long int)((log(2) * 64 * pidw64s)
/ log(10));
              |  ^~~~
        Please submit a full bug report,
        with preprocessed source if appropriate.
        See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
*/

/* #3

        g++ uninstall --> g++ install same error occurs
        tsuka@tsuka-n:~/pi64$ sudo apt-get purge --auto-remove g++
        tsuka@tsuka-n:~/pi64$ sudo apt-get install g++
*/
        printf("\nlpi10= %lld",lpi10);
}


#4 gnu gmp change 
gmp-h.in 150 line new
typedef struct
{
  long int _mp_alloc;           /* Number of *limbs* allocated and pointed
                                   to by the _mp_d field.  */
  long int _mp_size;            /* abs(_mp_size) is the number of limbs the
                                   last field points to.  If _mp_size is
                                   negative this is a negative number.  */
  mp_limb_t *_mp_d;             /* Pointer to the limbs.  */
} __mpz_struct;

gmp-h.in 150 line old

typedef struct
{
  int _mp_alloc;                /* Number of *limbs* allocated and pointed
                                   to by the _mp_d field.  */
  int _mp_size;                 /* abs(_mp_size) is the number of limbs the
                                   last field points to.  If _mp_size is
                                   negative this is a negative number.  */
  mp_limb_t *_mp_d;             /* Pointer to the limbs.  */
} __mpz_struct

#5 g++ -v
tsuka@tsuka-n:~$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-10ubuntu2'
--with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs 
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,
gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9
--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-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
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib
--with-tune=generic --enable-offload-targets=nvptx-none,hsa
--without-cuda-driver
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)

Reply via email to