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

            Bug ID: 89167
           Summary: internal compiler error due to mpfr assert at
                    init2.c:52
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marco.maggi-ipsu at poste dot it
  Target Milestone: ---

Created attachment 45593
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45593&action=edit
Preprocessed source file

On my x86_64-pc-linux-gnu, Slackware64 14.2, running a custom installation of
GCC 8.2.0, under the stock Slackware package glibc-2.23-x86_64-2_slack14.2, I
get a C compiler crash when compiling the following source:

/* demo.c */
#include <complex.h>
int
main (void)
{
  double complex        E = catan(CMPLX(0.5, 0.6));
  return 0;
}
/* end of file */

with the command line:

gcc -v -save-temps -c -o demo demo.c

The package GCC is compiled with:

$ /path/to/gcc-8.2.0/configure \
    --prefix=/opt/gcc/8.2.0 \
    --enable-languages=fortran,c,c++ \
    --disable-multilib

The output of the compiler command is:

>> gcc -v -save-temps -c -o demo demo.c
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-pc-linux-gnu
Configured with: /home/marco/var/build/devel/gcc-8.2.0/configure
--prefix=/opt/gcc/8.2.0 --enable-languages=fortran,c,c++ --disable-multilib
Thread model: posix
gcc version 8.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-o' 'demo' '-mtune=generic'
'-march=x86-64'
 /opt/gcc/8.2.0/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -E -quiet -v demo.c
-mtune=generic -march=x86-64 -fpch-preprocess -o demo.i
ignoring nonexistent directory
"/opt/gcc/8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/gcc/8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include
 /usr/local/include
 /opt/gcc/8.2.0/include
 /opt/gcc/8.2.0/lib/gcc/x86_64-pc-linux-gnu/8.2.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-o' 'demo' '-mtune=generic'
'-march=x86-64'
 /opt/gcc/8.2.0/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/cc1 -fpreprocessed demo.i
-quiet -dumpbase demo.c -mtune=generic -march=x86-64 -auxbase-strip demo
-version -o demo.s
GNU C17 (GCC) version 8.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1,
MPC version 1.1.0, isl version none
warning: MPFR header version 4.0.1 differs from library version 3.1.4.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C17 (GCC) version 8.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 8.2.0, GMP version 6.1.2, MPFR version 4.0.1,
MPC version 1.1.0, isl version none
warning: MPFR header version 4.0.1 differs from library version 3.1.4.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 142bb8855e8bf5550c1afdcffac827d9
init2.c:52: MPFR assertion failed: p >= 2 && p <=
((mpfr_prec_t)((mpfr_uprec_t)(~(mpfr_uprec_t)0)>>1))
demo.c: In function 'main':
demo.c:6:42: internal compiler error: Aborted
   double complex E = catan(CMPLX(0.5, 0.6));
                                          ^
0xa2861f crash_signal
        /home/marco/var/build/devel/gcc-8.2.0/gcc/toplev.c:325
0x7cab90 do_mpc_arg1
        /home/marco/var/build/devel/gcc-8.2.0/gcc/fold-const-call.c:346
0x7cce92 fold_const_call_cc
        /home/marco/var/build/devel/gcc-8.2.0/gcc/fold-const-call.c:1032
0x7cce92 fold_const_call_1
        /home/marco/var/build/devel/gcc-8.2.0/gcc/fold-const-call.c:1125
0x67c41c fold_builtin_1
        /home/marco/var/build/devel/gcc-8.2.0/gcc/builtins.c:8966
0x67c41c fold_builtin_n(unsigned int, tree_node*, tree_node**, int, bool)
        /home/marco/var/build/devel/gcc-8.2.0/gcc/builtins.c:9254
0x7c9cb2 fold(tree_node*)
        /home/marco/var/build/devel/gcc-8.2.0/gcc/fold-const.c:11937
0x604767 c_fully_fold_internal
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-fold.c:626
0x605d19 c_fully_fold(tree_node*, bool, bool*, bool)
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-fold.c:125
0x5d07b7 digest_init
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-typeck.c:7359
0x5d10e5 store_init_value(unsigned int, tree_node*, tree_node*, tree_node*)
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-typeck.c:7150
0x5b9fbe finish_decl(tree_node*, unsigned int, tree_node*, tree_node*,
tree_node*)
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-decl.c:4926
0x5fc972 c_parser_declaration_or_fndef
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-parser.c:2129
0x5fc24a c_parser_compound_statement_nostart
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-parser.c:5000
0x5fc396 c_parser_compound_statement
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-parser.c:4912
0x5fd9e3 c_parser_declaration_or_fndef
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-parser.c:2341
0x60344f c_parser_external_declaration
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-parser.c:1643
0x603c89 c_parser_translation_unit
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-parser.c:1524
0x603c89 c_parse_file()
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c/c-parser.c:18428
0x6463d6 c_common_parse_file()
        /home/marco/var/build/devel/gcc-8.2.0/gcc/c-family/c-opts.c:1147
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

The preprocessed file demo.i is attached.

Reply via email to