* Tree checking failure in jc1
@ 2010-12-10 20:25 Dave Korn
2010-12-11 9:59 ` Dave Korn
0 siblings, 1 reply; 2+ messages in thread
From: Dave Korn @ 2010-12-10 20:25 UTC (permalink / raw)
To: gcc, GCC Java
Hi lists,
I found a couple of new FAILs in my latest libjava testrun:
> FAIL: newarray_overflow -O3 compilation from source
> FAIL: newarray_overflow -O3 -findirect-dispatch compilation from source
These turn out to be tree checking failures:
> In file included from <built-in>:3:0:
> newarray_overflow.java:20:0: internal compiler error: tree check: expected class
> 'type', have 'declaration' (function_decl) in put_decl_node, at java/lang.c:405
... happening ...
> /* Append to decl_buf a printable name for NODE.
> Depending on VERBOSITY, more information about NODE
> is printed. Read the comments of decl_printable_name in
> langhooks.h for more. */
>
> static void
> put_decl_node (tree node, int verbosity)
> {
> int was_pointer = 0;
> if (TREE_CODE (node) == POINTER_TYPE)
> {
> node = TREE_TYPE (node);
> was_pointer = 1;
> }
> if (DECL_P (node) && DECL_NAME (node) != NULL_TREE)
> {
> if (TREE_CODE (node) == FUNCTION_DECL)
> {
> if (verbosity == 0 && DECL_NAME (node))
> /* We have been instructed to just print the bare name
> of the function. */
> {
> put_decl_node (DECL_NAME (node), 0);
> return;
> }
>
> /* We want to print the type the DECL belongs to. We don't do
> that when we handle constructors. */
> if (! DECL_CONSTRUCTOR_P (node)
> && ! DECL_ARTIFICIAL (node) && DECL_CONTEXT (node)
> /* We want to print qualified DECL names only
> if verbosity is higher than 1. */
> && verbosity >= 1)
> {
> put_decl_node (TYPE_NAME (DECL_CONTEXT (node)),
> verbosity);
... here: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The decl pointed to by 'node' is a function_decl for a builtin:
<function_decl 0x7ff8f580 __builtin_prefetch
type <function_type 0x7fe52ee0
type <void_type 0x7ff608a0 void asm_written VOID
align 1 symtab 0 alias set -1 canonical type 0x7ff608a0
pointer_to_this <pointer_type 0x7ff60900> chain <type_decl
0x7fdd0380 void>>
QI
size <integer_cst 0x7fef0108 constant 8>
unit size <integer_cst 0x7fef0120 constant 1>
align 8 symtab 0 alias set -1 canonical type 0x7fe52ee0
arg-types <tree_list 0x7feff138 value <pointer_type 0x7ff609c0>
chain <tree_list 0x7fef0b10 value <void_type 0x7ff608a0 void>>>
pointer_to_this <pointer_type 0x7fe53000>>
addressable public external built-in QI file <built-in> line 0 col 0
align 8 built-in BUILT_IN_NORMAL:BUILT_IN_PREFETCH context <function_decl
0x7ff82b80 int_check> chain <var_decl 0x7fe2f900 _Utf15>>
and the DECL_CONTEXT turns out to be another function, one present in the
source of the testcase:
<function_decl 0x7ff82b80 int_check
type <function_type 0x7ff648c0
type <void_type 0x7ff608a0 void asm_written VOID
align 1 symtab 0 alias set -1 canonical type 0x7ff608a0
pointer_to_this <pointer_type 0x7ff60900> chain <type_decl
0x7fdd0380 void>>
QI
size <integer_cst 0x7fef0108 constant 8>
unit size <integer_cst 0x7fef0120 constant 1>
align 8 symtab 0 alias set -1 canonical type 0x7ff648c0
arg-types <tree_list 0x7fef0b10 value <void_type 0x7ff608a0 void>>
pointer_to_this <pointer_type 0x7fe27140>>
addressable public decl_2 QI file newarray_overflow.java line 20 col 0
align 8 context <record_type 0x7ff65520 newarray_overflow> initial <block
0x7fde6af8>
result <result_decl 0x7fe100a0 D.246 type <void_type 0x7ff608a0 void>
ignored VOID file newarray_overflow.java line 0 col 0
align 1 context <function_decl 0x7ff82b80 int_check>>
struct-function 0x7ff98df8 chain <function_decl 0x7ff82c00 object_check>>
... which is why the TYPE_NAME macro complains.
Is it expected for a builtin to appear as if it were a nested function like
this? If so, would it make sense to do something like replace this:
put_decl_node (TYPE_NAME (DECL_CONTEXT (node)),
verbosity);
with:
put_decl_node (TREE_CODE (DECL_CONTEXT (node)) == FUNCTION_DECL
? DECL_CONTEXT (node)
: TYPE_NAME (DECL_CONTEXT (node)),
verbosity);
so we just treat the builtin as another layer of scope?
cheers,
DaveK
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Tree checking failure in jc1
2010-12-10 20:25 Tree checking failure in jc1 Dave Korn
@ 2010-12-11 9:59 ` Dave Korn
0 siblings, 0 replies; 2+ messages in thread
From: Dave Korn @ 2010-12-11 9:59 UTC (permalink / raw)
To: gcc, GCC Java
On 10/12/2010 20:49, Dave Korn wrote:
> I found a couple of new FAILs in my latest libjava testrun:
>
>> FAIL: newarray_overflow -O3 compilation from source
>> FAIL: newarray_overflow -O3 -findirect-dispatch compilation from source
>
> These turn out to be tree checking failures:
>
>> In file included from <built-in>:3:0:
>> newarray_overflow.java:20:0: internal compiler error: tree check: expected class
>> 'type', have 'declaration' (function_decl) in put_decl_node, at java/lang.c:405
This turned out to be a second bug, triggered by -fdump-tree-all attempting
to output some line of mangled gimple. Without that flag, or ...
> put_decl_node (TREE_CODE (DECL_CONTEXT (node)) == FUNCTION_DECL
> ? DECL_CONTEXT (node)
> : TYPE_NAME (DECL_CONTEXT (node)),
> verbosity);
... with the suggested fix, compilation proceeds to the site of the actual
crash that occurred in the testsuite run: a segfault in gimple.c#walk_gimple_op():
> Program received signal SIGSEGV, Segmentation fault.
> 0x007cfdbe in walk_gimple_op (stmt=0x7fe106e0, callback_op=0x4a0ef0 <verify_expr
> .265801>, wi=0x326c554) at /gnu/gcc/gcc/gcc/gimple.c:2841
> 2841 return !AGGREGATE_TYPE_P (type);
> (gdb) call debug_gimple_stmt (stmt)
> newarray_overflow.int_check.__builtin_prefetch (D.1284_85, 0, );
>
> (gdb)
I think this is the same as PR29710(*) "gnat ICEs on -fprefetch-loop-arrays
-O1", so I'll put the rest of my findings there. Note that weird missing
third argument: it turns out that integer_three_node hasn't been initialised
at the time that issue_prefetch_ref() attempts to pass it to gimple_build_call().
cheers,
DaveK
--
(*) - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29710
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-11 9:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-10 20:25 Tree checking failure in jc1 Dave Korn
2010-12-11 9:59 ` Dave Korn
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).