Bootstrap error on arm-netbsd1.4 (release branch)

Richard Earnshaw rearnshaATarm.com
Wed Sep 15 10:15:00 GMT 1999


>   In message <199908121543.QAA04560@sun52.NIS.cambridge>you write:
>   > Arrgh!  I thought this was working ok, but I tried a bootstrap of the 
>   > release branch (as of this morning) and I get an ICE when building 
>   > libchill/chillstdio.c.  I think it can be reduced to
>   > 
>   > 	static void foo(void) __attribute__ ((constructor));
>   > 
>   > 	static void foo(void)
>   > 	{
>   > 	  printf("Hello\n");
>   > 	}
>   > 
> [ ... ]
> 
>   > (call_insn 5 4 6 (parallel[ 
>   >             (set (reg:CC_NOOV 0 r0)
>   >                 (call (mem:SI (symbol_ref:SI ("foo")) 0)
>   >                     (const_int 0 [0x0])))
>   >             (clobber (reg:SI 14 lr))
>   >         ] ) -1 (nil)
>   >     (nil)
>   >     (nil))
> I'd suggest a breakpoint in make_call_insn_raw conditional on 
> cur_insn_uid == 5
> 
> Then walk backwards from that point to see who/what is setting the weird
> mode on the return register from the call.
> 
> I would also verify that the stage1 compiler exhibits this bug...  It may be
> the case that the compiler is mis-compiling itself...
> 
> jeff
> 


Hmm, this has now started happening on the trunk as well, so I've had 
another go at tracking it down.  What is happening is that the permanent 
void_type_node is getting corrupted because the tree structure generated 
by the code to wrap constructors is incorrect.

Setting a breakpoint on grokdeclarator shows that the tree expression 
being created in finish_file is:

<call_expr 0x1e5008 allocated from temp_decl_obstack
   
    arg 0 <identifier_node 0x1fe5b8 _GLOBAL_.I._home_rearnsha_ch2.c7Mkefd 
allocated from permanent_obstack
        permanent>
    arg 1 <tree_list 0x1fe5a4 allocated from permanent_obstack
        permanent
        value <void_type 0x1e8658 void allocated from permanent_obstack
            permanent VOID
            size <integer_cst 0x1e8628 constant permanent 0>
            align 8 symtab 19 alias set -1
            pointer_to_this <pointer_type 0x1e86d0 __builtin_va_list>>>
    rtl 2 (nil)

The arg 1 here is incorrect, it should be part of a chain, and the code in 
grokdeclarator that walks the params list assumes this:

            for (link = last_function_parm_tags;
                 link;
                 link = TREE_CHAIN (link))
              TYPE_CONTEXT (TREE_VALUE (link)) = type;

The arg1 should read:

    arg 1 <tree_list 0x1ff60c allocated from permanent_obstack
        permanent
        chain <tree_list 0x1ff5a4 allocated from permanent_obstack
            permanent value <void_type 0x1e9658 void>>>

and the patch below generates the extra level of tree to handle this.

I'm not an expert on tree handling, so can someone please check my 
analysis.  If this is correct, can the patch please be applied to the 
release branch as well, since this is the source of the bootstrap error on 
the arm-netbsd configuration.

Richard.

<date>  Richard Earnshaw (rearnsha@arm.com)

	* c-decl.c (finish_file case ndef ASM_OUTPUT_{CON,DE}STRUCTOR): 
	Correctly build argument list to constructor and destructor functions.




More information about the Gcc-patches mailing list