public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [AARCH64, PATCH] Fix ICE in aarch64_float_const_representable_p
@ 2014-05-30  8:15 Tom de Vries
  2014-05-30  8:20 ` Ramana Radhakrishnan
  2014-06-02 12:29 ` Marcus Shawcroft
  0 siblings, 2 replies; 4+ messages in thread
From: Tom de Vries @ 2014-05-30  8:15 UTC (permalink / raw)
  To: Marcus Shawcroft; +Cc: GCC Patches, James Greenhalgh

[-- Attachment #1: Type: text/plain, Size: 3259 bytes --]

Marcus,

when building for aarch64-linux-gnu with --enable-checking=yes,rtl, I run into 
the following error:
...
In file included from src/libgcc/libgcc2.c:56:0:
src/libgcc/libgcc2.c: In function ‘__floattisf’:
src/libgcc/libgcc2.h:200:20: internal compiler error: RTL check: expected code 
'const_double' and not mode 'VOID', have code 'const_double' and mode 'VOID' in 
aarch64_float_const_representable_p, at config/aarch64/aarch64.c:8481
  #define __NDW(a,b) __ ## a ## ti ## b
                     ^
src/libgcc/libgcc2.h:293:21: note: in expansion of macro ‘__NDW’
  #define __floatdisf __NDW(float,sf)
                      ^
src/libgcc/libgcc2.c:1569:14: note: in expansion of macro ‘__floatdisf’
  #define FUNC __floatdisf
               ^
src/libgcc/libgcc2.c:1579:1: note: in expansion of macro ‘FUNC’
  FUNC (DWtype u)
  ^
0xc1a278 rtl_check_failed_code_mode(rtx_def const*, rtx_code, machine_mode, 
bool, char const*, int, char const*)
	src/gcc/rtl.c:833
0x1062b7b aarch64_float_const_representable_p(rtx_def*)
	src/gcc/config/aarch64/aarch64.c:8481
0x1052ae2 aarch64_rtx_costs
	src/gcc/config/aarch64/aarch64.c:5003
0x1059a9c aarch64_rtx_costs_wrapper
	src/gcc/config/aarch64/aarch64.c:5804
0xc38f1a rtx_cost(rtx_def*, rtx_code, int, bool)
	src/gcc/rtlanal.c:3878
0xb159a9 avoid_expensive_constant
	src/gcc/optabs.c:1389
0xb15ca9 expand_binop_directly
	src/gcc/optabs.c:1441
0xb161e7 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*, 
int, optab_methods)
	src/gcc/optabs.c:1568
0x87f27f expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
	src/gcc/expr.c:9200
0x87fe4b expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, 
rtx_def**, bool)
	src/gcc/expr.c:9388
0x879534 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier, 
rtx_def**, bool)
	src/gcc/expr.c:7921
0x79a720 expand_normal
	src/gcc/expr.h:471
0x79cdb3 do_jump_by_parts_greater
	src/gcc/dojump.c:741
0x79b682 do_jump_1(tree_code, tree_node*, tree_node*, rtx_def*, rtx_def*, int)
	src/gcc/dojump.c:280
0x79a8ce jumpifnot_1(tree_code, tree_node*, tree_node*, rtx_def*, int)
	src/gcc/dojump.c:138
0x700de4 expand_gimple_cond
	src/gcc/cfgexpand.c:2145
0x70ed7f expand_gimple_basic_block
	src/gcc/cfgexpand.c:5063
0x71189c execute
	src/gcc/cfgexpand.c:5803
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
...

We assert here during REAL_VALUE_FROM_CONST_DOUBLE because x has VOIDmode, which 
means it has integer rather than floating point type:
...
bool
aarch64_float_const_representable_p (rtx x)
{
   /* This represents our current view of how many bits
      make up the mantissa.  */
   int point_pos = 2 * HOST_BITS_PER_WIDE_INT - 1;
   int exponent;
   unsigned HOST_WIDE_INT mantissa, mask;
   REAL_VALUE_TYPE r, m;
   bool fail;

   if (!CONST_DOUBLE_P (x))
     return false;

   REAL_VALUE_FROM_CONST_DOUBLE (r, x);
...

Attached patch fixes the ICE by handling the case that x is VOIDmode, and allows 
me to complete the build.

OK for trunk if build and test succeeds?

I think the call site in aarch64_rtx_costs may need a separate fix.

Thanks,
- Tom

[-- Attachment #2: 0007-Fix-ICE-in-aarch64_float_const_representable_p.patch --]
[-- Type: text/x-patch, Size: 687 bytes --]

2014-05-30  Tom de Vries  <tom@codesourcery.com>

	* config/aarch64/aarch64.c (aarch64_float_const_representable_p): Handle
	case that x has VOIDmode.
---
 gcc/config/aarch64/aarch64.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 4ece0c6..ce0e7dc 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -8478,6 +8478,9 @@ aarch64_float_const_representable_p (rtx x)
   if (!CONST_DOUBLE_P (x))
     return false;
 
+  if (GET_MODE (x) == VOIDmode)
+    return false;
+
   REAL_VALUE_FROM_CONST_DOUBLE (r, x);
 
   /* We cannot represent infinities, NaNs or +/-zero.  We won't
-- 
1.9.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-02 12:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-30  8:15 [AARCH64, PATCH] Fix ICE in aarch64_float_const_representable_p Tom de Vries
2014-05-30  8:20 ` Ramana Radhakrishnan
2014-06-01 10:04   ` Tom de Vries
2014-06-02 12:29 ` Marcus Shawcroft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).