This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RTL]--emit lib call got error


Hi, I'm trying to patch GCC 3.4.0 and I've successfully emit a lib call in every compiled function.
using the following statement:

emit_library_call(gen_rtx(SYMBOL_REF, Pmode, "my_function"), LCT_NORMAL, SImode, 0);
//my_function is defined in a shared object

But when I modified the above statement to

emit_library_call(gen_rtx(SYMBOL_REF, Pmode, "my_function_1"), LCT_NORMAL, SImode, 1, GEN_INT(0), SImode);

trying to pass an argument(integer 0) to the emitted lib call, I got some error.
Then I debuged cc1, it seemed that the passed argument was not what I expected.
I wonder how this happen, would anybody give me some advice?

WangYi

My debug message:(I think the bt #6 emit_lib_call_value_1 should be noticed, it looked like the arguments passed is messed.)
$ gdb cc1 
GNU gdb 6.0
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...
Breakpoint 1 at 0x80be4c2: file /home/ups/src/gcc-3.4.0-patched/gcc/diagnostic.c, line 584.
Breakpoint 2 at 0x8049820
Breakpoint 3 at 0x80495d0
(gdb) run -dr /home/ups/a.c
Starting program: /home/ups/build/gcc-3.4.0-patched/gcc/cc1 -dr /home/ups/a.c
Breakpoint 2 at 0x40051930
Breakpoint 3 at 0x400505a0
 a
 main
//program halted here and I pressed ctrl+c

Program received signal SIGINT, Interrupt.
0x08231ed2 in ggc_alloc (size=1226062116) at /home/ups/src/gcc-3.4.0-patched/gcc/ggc-page.c:1205
1205    }
(gdb) bt
#0  0x08231ed2 in ggc_alloc (size=1226062116) at /home/ups/src/gcc-3.4.0-patched/gcc/ggc-page.c:1205
During symbol reading, Incomplete CFI data; unspecified registers at 0x08231da2.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08231da2.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08231da2.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08231da2.
#1  0x0811e6f1 in gen_rtx_fmt_ee (code=PLUS, mode=V16QImode, arg0=0x23, arg1=0x23) at genrtl.c:33
During symbol reading, Incomplete CFI data; unspecified registers at 0x0811e6ec.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0811e6ec.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0811e6ec.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0811e6ec.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0811e6ec.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0811e6ec.
#2  0x0823c1a9 in ix86_expand_binary_operator (code=PLUS, mode=SImode, operands=0xbfffdf80)
    at /home/ups/src/gcc-3.4.0-patched/gcc/config/i386/i386.c:8484
During symbol reading, Incomplete CFI data; unspecified registers at 0x0823c1f2.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0823c1f2.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0823c1f2.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0823c1f2.
#3  0x0815aed0 in gen_addsi3 (operand0=0x49143924, operand1=0x49143924, operand2=0x49143924) at insn-emit.c:9102
During symbol reading, Incomplete CFI data; unspecified registers at 0x0815aed0.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0815aed0.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0815aed0.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0815aed0.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0815aed0.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0815aed0.
#4  0x081b7f98 in expand_binop (mode=SImode, binoptab=0x40347400, op0=0x4033f000, op1=0x4033e290, target=0x4033f000, 
    unsignedp=0, methods=OPTAB_LIB_WIDEN) at /home/ups/src/gcc-3.4.0-patched/gcc/optabs.c:807
#5  0x080de7aa in adjust_stack (adjust=0x903) at /home/ups/src/gcc-3.4.0-patched/gcc/explow.c:813
#6  0x0809ef21 in emit_library_call_value_1 (retval=0, orgfun=0x491425a0, value=0x0, fn_type=1226073424, outmode=VOIDmode, 
    nargs=1, p=0xbfffe298 "糕?A<\021\b?8@<Y=\b?\024I\230?@\230?@\025")
    at /home/ups/src/gcc-3.4.0-patched/gcc/calls.c:4251
#7  0x0809f7d3 in emit_library_call (orgfun=0x491425a0, fn_type=LCT_NORMAL, outmode=VOIDmode, nargs=1)
    at /home/ups/src/gcc-3.4.0-patched/gcc/calls.c:4416
#8  0x08113c92 in myfunction () at /home/ups/src/gcc-3.4.0-patched/gcc/function.c:6861
#9  0x0824b638 in tree_rest_of_compilation (fndecl=0x4040d798, nested_p=false)
    at /home/ups/src/gcc-3.4.0-patched/gcc/tree-optimize.c:147
#10 0x080581e4 in c_expand_body_1 (fndecl=0x4040d798, nested_p=0) at /home/ups/src/gcc-3.4.0-patched/gcc/c-decl.c:6153
#11 0x080582f7 in c_expand_body (fndecl=0x23) at /home/ups/src/gcc-3.4.0-patched/gcc/c-decl.c:6185
#12 0x0824cd4d in cgraph_expand_function (node=0x4040d9b4) at /home/ups/src/gcc-3.4.0-patched/gcc/cgraphunit.c:533
#13 0x0824c58d in cgraph_assemble_pending_functions () at /home/ups/src/gcc-3.4.0-patched/gcc/cgraphunit.c:143
#14 0x0824c6a9 in cgraph_finalize_function (decl=0x4040d798, nested=false)
    at /home/ups/src/gcc-3.4.0-patched/gcc/cgraphunit.c:224
#15 0x08058035 in finish_function () at /home/ups/src/gcc-3.4.0-patched/gcc/c-decl.c:6110
#16 0x0804a147 in yyparse () at c-parse.y:411
#17 0x0804c8e3 in c_parse_file () at c-parse.y:3028
#18 0x080764f8 in c_common_parse_file (set_yydebug=1226062116) at /home/ups/src/gcc-3.4.0-patched/gcc/c-opts.c:1237
#19 0x08218bba in compile_file () at /home/ups/src/gcc-3.4.0-patched/gcc/toplev.c:1822
#20 0x0821ca28 in do_compile () at /home/ups/src/gcc-3.4.0-patched/gcc/toplev.c:4650
#21 0x0821cb01 in toplev_main (argc=3, argv=0xbfffecf4) at /home/ups/src/gcc-3.4.0-patched/gcc/toplev.c:4690
#22 0x0808ca93 in main (argc=3, argv=0xbfffecf4) at /home/ups/src/gcc-3.4.0-patched/gcc/main.c:35
(gdb) 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]