$ cat test.c int func(_Decimal32 v) { return __builtin_isinf(v); } $ gcc -c test.c test.c: In function 'func': test.c:2:25: internal compiler error: in prepare_float_lib_cmp, at optabs.c:4391 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ gcc -c -O test.c test.c: In function 'func': test.c:1:5: internal compiler error: in decimal_to_decnumber, at dfp.c:115 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.
Somewhere I added generic C frontend argument checking for builtins... c-common.c:check_builtin_function_arguments. Which checks for REAL_TYPE arguments to isinf. Janis, is isinf not supposed to be used for decimal floating point or do we simply lack expansion for it?
Subject: Re: ICE with __builtin_isinf() and _Decimal argument The most recent draft of TR 24732 I have (I don't have the final published TR) says that all the type-generic classification and comparison macros have decimal floating-point versions (in the case of the comparison macros, if one argument is decimal so must the other one be decimal). So I'd say that GCC's type-generic built-in functions, that it provides for use in implementing the standard macros, ought to support decimal floating point.
This looks related. $ cat test.c _Decimal64 func() { return 9e384dd + 9e384dd; } $ gcc -c test.c test.c: In function 'func': test.c:2:3: internal compiler error: in decimal_to_decnumber, at dfp.c:115 ...
The tests also fail on powerpc64-linux, although the first one gets the same error with and without optimization. elm3c105% cat 43374-1.c int func(_Decimal32 v) { return __builtin_isinf(v); } elm3c105% /home/janis/tools/gcc-trunk-anonsvn/bin/gcc -c 43374-1.c 43374-1.c: In function ‘func’: 43374-1.c:2:25: internal compiler error: in prepare_float_lib_cmp, at optabs.c:4391 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. elm3c105% /home/janis/tools/gcc-trunk-anonsvn/bin/gcc -c -O 43374-1.c 43374-1.c: In function ‘func’: 43374-1.c:1:5: internal compiler error: in prepare_float_lib_cmp, at optabs.c:4391 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. elm3c105% cat 43374-2.c _Decimal64 func() { return 9e384dd + 9e384dd; } elm3c105% /home/janis/tools/gcc-trunk-anonsvn/bin/gcc -c 43374-2.c 43374-2.c:3:1: internal compiler error: in decimal_to_decnumber, at dfp.c:115 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. elm3c105% /home/janis/tools/gcc-trunk-anonsvn/bin/gcc -c -O 43374-2.c 43374-2.c:3:1: internal compiler error: in decimal_to_decnumber, at dfp.c:115 with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. The failures are the same for -m32 and -m64.
Update : $ gcc-7-20170205 -c pr43374.c pr43374.c: In function 'func': pr43374.c:4:10: internal compiler error: in decimal_to_decnumber, at dfp.c:134 return __builtin_isinf(v); ^~~~~~~~~~~~~~~~~~ 0x12b9f38 decimal_to_decnumber ../../gcc/dfp.c:134 0x12ba0bf encode_decimal32(real_format const*, long*, real_value const*) ../../gcc/dfp.c:161 0xb51d15 real_to_target(long*, real_value const*, format_helper) ../../gcc/real.c:2835 0xbc73bc simplify_immed_subreg ../../gcc/simplify-rtx.c:5824 0xbd3578 simplify_gen_subreg(machine_mode, rtx_def*, machine_mode, unsigned int) ../../gcc/simplify-rtx.c:6260 0x8ba3b5 emit_move_via_integer ../../gcc/expr.c:3301 0x8c7198 emit_move_insn_1(rtx_def*, rtx_def*) ../../gcc/expr.c:3652 0x8c7494 emit_move_insn(rtx_def*, rtx_def*) ../../gcc/expr.c:3738 0x7a1434 emit_library_call_value_1 ../../gcc/calls.c:4895 0x7a82af emit_library_call_value(rtx_def*, rtx_def*, libcall_type, machine_mode, int, ...) ../../gcc/calls.c:5159 0xaf5ab6 prepare_float_lib_cmp ../../gcc/optabs.c:4172 0xaf5ab6 prepare_cmp_insn ../../gcc/optabs.c:3945 0xaf5bf5 emit_cmp_and_jump_insns(rtx_def*, rtx_def*, rtx_code, rtx_def*, machine_mode, int, rtx_def*, int) ../../gcc/optabs.c:4051 0x8314cc do_compare_rtx_and_jump(rtx_def*, rtx_def*, rtx_code, int, machine_mode, rtx_def*, rtx_code_label*, rtx_code_label*, int) ../../gcc/dojump.c:1145 0x8319e7 do_compare_rtx_and_jump(rtx_def*, rtx_def*, rtx_code, int, machine_mode, rtx_def*, rtx_code_label*, rtx_code_label*, int) ../../gcc/dojump.c:1140 0x8b6314 emit_store_flag_force(rtx_def*, rtx_code, rtx_def*, rtx_def*, machine_mode, int, int) ../../gcc/expmed.c:5936 0x8d7cde do_store_flag ../../gcc/expr.c:11453 0x8d7cde expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier) ../../gcc/expr.c:9203 0x7b6382 expand_gimple_stmt_1 ../../gcc/cfgexpand.c:3676 0x7b6382 expand_gimple_stmt ../../gcc/cfgexpand.c:3737