gnupic: gpal external functions - seg fault
Subject:
Re: gpal external functions - seg fault
From:
Craig Franklin ####@####.####
Date:
12 Sep 2004 14:56:30 +0100
Message-Id: <41436676.4050404@users.sourceforge.net>
Fixed.
Index: analyze.c
===================================================================
RCS file: /cvsroot/gputils/gputils/gpal/analyze.c,v
retrieving revision 1.17
diff -u -r1.17 analyze.c
--- analyze.c 25 Jul 2004 02:06:03 -0000 1.17
+++ analyze.c 12 Sep 2004 13:50:30 -0000
@@ -470,6 +470,7 @@
tree *call_args;
tree *assignment;
char *return_name;
+ struct variable *return_var;
enum size_tag call_size;
gp_boolean load_result = false;
@@ -562,6 +563,11 @@
tree *symbol;
return_name = mangle_name2(var->name, "return");
+
+ return_var = get_global(return_name);
+ assert(return_var != NULL);
+ return_var->is_used = true;
+
symbol = mk_symbol(return_name, NULL);
COPY_DEBUG(call, symbol);
codegen_expr(symbol, codegen_size);
@@ -1666,6 +1672,11 @@
sym_func,
FILE_CODE(state.module),
NULL);
+ add_global_symbol(mangle_name2(var->name, "return"),
+ current,
+ sym_udata,
+ FILE_UDATA(state.module),
+ FUNC_RET(current));
add_arg_symbols(current,
var->name,
FILE_UDATA(state.module),
I have a patch in work to reduce the number of banksels. I hope to get
it done today.
Geoff Horn wrote:
>The bug in codegen.c is fixed and the cvs example for gpal compiles and links
>so I've moved on to a simple test.
>
>I find that any use of a simple function from another file fails to compile
>and gives a seg fault.
>
>If I just convert the function to a procedure (and use it as a procedure of
>course) all is well.
>
>I've looked through all the examples for a use of an external function but
>cannot find one. The ones defined in the cvs example suite (stack.pub) are
>not used anywhere.
>
>Geoff
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ####@####.####
>For additional commands, e-mail: ####@####.####
>
>
>
>