Bug 43374 - ICE with __builtin_isinf() and _Decimal argument
Summary: ICE with __builtin_isinf() and _Decimal argument
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-15 03:29 UTC by Roman Kononov
Modified: 2017-02-07 17:20 UTC (History)
4 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2010-03-15 11:06:23


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Kononov 2010-03-15 03:29:11 UTC
$ 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.
Comment 1 Richard Biener 2010-03-15 11:06:23 UTC
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?
Comment 2 joseph@codesourcery.com 2010-03-15 11:18:03 UTC
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.

Comment 3 Roman Kononov 2010-03-18 14:52:30 UTC
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
...
Comment 4 Janis Johnson 2010-03-18 17:27:17 UTC
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.
Comment 5 Gerhard Steinmetz 2017-02-07 17:20:57 UTC
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