[gnu.gcc.bug] Problem porting gcc 1.35 - can't access local variables

clint@ibmpcug.co.uk (Douglas Clinton) (12/27/89)

I am porting gcc 1.35 to an Acorn R140 unix workstation and I have run
up against a problem with local variables. It is allocating the correct
amount of space on the stack upon entering the function but it core
dumps when I try to access any of the local vars. My machine
description is far from complete at the moment but I would appreciate
any tips as to what might be missing at the moment so that I can start
testing areas of the code before completing the md.

I have implemented the basic move instructions and the adds, subs,
muls and divs, as well as a few others.

cc1 core dumps with an illegal instruction at line 1517 of toplev.c in
rest_of_compilation, called from finish_function. It seems to be having
trouble with trees.

Here are the trees produced by the compiler. The first is produced
compiling the following program which does not cause a core dump:

main()
{
	int i;
}

The tree:

     167  function_decl name = main; at hello.c line 2;
               SI; size = <>*1; alignment = 1; type = 115; [public
static asm_written permanent] 
               offset = 0;voffset = 19*1; context = <>;
               arguments = <>; result = 168; initial = 173; chain = 160;
     115    function_type EP; size = 6*8; alignment = 32; type = 19;
[permanent] 
                 pointers_to_this = <>; arg_types = <>; chain = 119;
      19      integer_type SI; size = 4*8; alignment = 32; type = <>;
[permanent] 
                   pointers_to_this = 110; min = -2147483648; max =
2147483647;precision = 32; chain = 24;
      20        integer_cst = -2147483648; type = 19; [literal
permanent]  chain = <>;
     110        pointer_type SI; size = 3*8; alignment = 32; type = 19;
[unsigned permanent] 
                     pointers_to_this = <>; chain = 109;
     168    result_decl name = <value>; at hello.c line 2;
                 SI; size = 4*8; alignment = 32; type = 19; [permanent]
                 offset = 0; context = 173; chain = <>;
     173      let_stmt type = <>; []  at  line 0; vars = <>; tags = <>;
supercontext = <>; bind_size = <>; body = 172; chain = <>;
     172        let_stmt type = <>; []  at  line 0; vars = 171; tags =
<>; supercontext = 173; bind_size = <>; body = <>; chain = <>;
     171          var_decl name = i; at hello.c line 3;
                       SI; size = 4*8; alignment = 32; type = 19; [] 
                       offset = 0; context = 172; chain = <>;


The second tree is produced by this program and does crash:

main()
{
	int i;
	i = 0;
}

The tree:

     167  function_decl name = main; at hello.c line 2;
               SI; size = <>*1; alignment = 1; type = 115; [public
static asm_written permanent] 
               offset = 0;voffset = 19*1; context = <>;
               arguments = <>; result = 168; initial = 176; chain = 160;
     115    function_type EP; size = 6*8; alignment = 32; type = 19;
[permanent] 
                 pointers_to_this = <>; arg_types = <>; chain = 119;
      19      integer_type SI; size = 4*8; alignment = 32; type = <>;
[permanent] 
                   pointers_to_this = 110; min = -2147483648; max =
2147483647;precision = 32; chain = 24;
      20        integer_cst = -2147483648; type = 19; [literal
permanent]  chain = <>;
     110        pointer_type SI; size = 3*8; alignment = 32; type = 19;
[unsigned permanent] 
                     pointers_to_this = <>; chain = 109;
     168    result_decl name = <value>; at hello.c line 2;
                 SI; size = 4*8; alignment = 32; type = 19; [permanent] 
                 offset = 0; context = 176; chain = <>;
     176      let_stmt type = <>; []  at  line 0; vars = <>; tags = <>;
supercontext = <>; bind_size = <>; body = 175; chain = <>;
     175        let_stmt type = <>; []  at  line 0; vars = 171; tags =
<>; supercontext = 176; bind_size = <>; body = <>; chain = <>;
     171          var_decl name = i; at hello.c line 3;
                       SI; size = 4*8; alignment = 32; type = 19; [used] 
                       offset = 0; context = 175; chain = <>;


As far as I can see, the only significant difference is the [used] in
context 171. I don't really understand trees at the moment so I don't
know what this means.

Can you help me?

Regards,
Doug Clinton