How to add a new operand to an expression?

Carlo Wood carlo@alinoe.com
Thu Oct 9 14:48:00 GMT 2003


I want to add a new operand to the CALL_EXPR.
In order to do so, I increased the number in tree.def:

DEFTREECODE (CALL_EXPR, "call_expr", 'e', 3)   // was 2 before

Next, I pass an extra 'tree' argument to the
build (CALL_EXPR, ...) calls.

The extra argument is a WFL, allocated/generated with a
call to build_expr_wfl.  For example:

wfl = build_expr_wfl (NULL_TREE, input_location.file, input_location.line, 0);
function = build (CALL_EXPR, result_type, function, parms, wfl);

but, for some non-understandable reason this causes an ICE
here:

Program received signal SIGSEGV, Segmentation fault.
0x084c6165 in lookup_page_table_entry (p=0x8121568)
    at ../../../gcc/gcc-mainline/gcc/ggc-page.c:568
568       return base[L1][L2];
(gdb) up
#1  0x084c4bc1 in ggc_set_mark (p=0x8121568)
    at ../../../gcc/gcc-mainline/gcc/ggc-page.c:1196
1196      entry = lookup_page_table_entry (p);
(gdb) l
1191      unsigned bit, word;
1192      unsigned long mask;
1193
1194      /* Look up the page on which the object is alloced.  If the object
1195         wasn't allocated by the collector, we'll probably die.  */
1196      entry = lookup_page_table_entry (p);
1197    #ifdef ENABLE_CHECKING
1198      if (entry == NULL)
1199        abort ();
1200    #endif

where base[L1] is 0x0.

And

(gdb) p p
$1 = (const void *) 0x8121568


With backtrace

#0  0x084c6165 in lookup_page_table_entry (p=0x8121568)
    at ../../../gcc/gcc-mainline/gcc/ggc-page.c:568
#1  0x084c4bc1 in ggc_set_mark (p=0x8121568)
    at ../../../gcc/gcc-mainline/gcc/ggc-page.c:1196
#2  0x08095be8 in gt_ggc_mx_lang_tree_node (x_p=0x8121568) at gtype-cp.h:115
#3  0x0809659a in gt_ggc_mx_lang_tree_node (x_p=0x407f04a0) at gtype-cp.h:265
#4  0x0809659a in gt_ggc_mx_lang_tree_node (x_p=0x407f0480) at gtype-cp.h:265
#5  0x0809659a in gt_ggc_mx_lang_tree_node (x_p=0x407f7d0c) at gtype-cp.h:265
#6  0x0809659a in gt_ggc_mx_lang_tree_node (x_p=0x407f0460) at gtype-cp.h:265
#7  0x0809659a in gt_ggc_mx_lang_tree_node (x_p=0x407f7c1c) at gtype-cp.h:265
#8  0x0809659a in gt_ggc_mx_lang_tree_node (x_p=0x407f7c08) at gtype-cp.h:265
#9  0x08096059 in gt_ggc_mx_lang_tree_node (x_p=0x407ec2f4) at gtype-cp.h:187
#10 0x0809622b in gt_ggc_mx_lang_tree_node (x_p=0x407eb57c) at gtype-cp.h:215
#11 0x08095e89 in gt_ggc_mx_lang_tree_node (x_p=0x4088faf8) at gtype-cp.h:158
#12 0x0809595e in gt_ggc_mx_cp_binding_level (x_p=0x404b7ca8) at gtype-cp.h:68
#13 0x08096a47 in gt_ggc_mx_lang_decl (x_p=0x40526de8) at gtype-cp.h:357
#14 0x080960ab in gt_ggc_mx_lang_tree_node (x_p=0x40539804) at gtype-cp.h:190
#15 0x08096293 in gt_ggc_mx_lang_tree_node (x_p=0x408a3948) at gtype-cp.h:219
#16 0x080960e2 in gt_ggc_mx_lang_tree_node (x_p=0x408a39b4) at gtype-cp.h:194
#17 0x08096320 in gt_ggc_mx_lang_tree_node (x_p=0x408a4460) at gtype-cp.h:226
#18 0x080960fc in gt_ggc_mx_lang_tree_node (x_p=0x408a3e58) at gtype-cp.h:195
#19 0x08095e89 in gt_ggc_mx_lang_tree_node (x_p=0x408a3ec4) at gtype-cp.h:158
#20 0x0809622b in gt_ggc_mx_lang_tree_node (x_p=0x4089df30) at gtype-cp.h:215
#21 0x08095ef1 in gt_ggc_mx_lang_tree_node (x_p=0x408a0ca8) at gtype-cp.h:162
#22 0x08096320 in gt_ggc_mx_lang_tree_node (x_p=0x408a2cbc) at gtype-cp.h:226
#23 0x08095ea3 in gt_ggc_mx_lang_tree_node (x_p=0x40887804) at gtype-cp.h:159
#24 0x08096302 in gt_ggc_mx_lang_tree_node (x_p=0x4088a3e8) at gtype-cp.h:225
#25 0x08096a2b in gt_ggc_mx_lang_decl (x_p=0x40881910) at gtype-cp.h:354
#26 0x080960ab in gt_ggc_mx_lang_tree_node (x_p=0x40887798) at gtype-cp.h:190
#27 0x0809622b in gt_ggc_mx_lang_tree_node (x_p=0x408862f4) at gtype-cp.h:215
#28 0x08095ef1 in gt_ggc_mx_lang_tree_node (x_p=0x4088672c) at gtype-cp.h:162
#29 0x08096320 in gt_ggc_mx_lang_tree_node (x_p=0x40885424) at gtype-cp.h:226
#30 0x080960fc in gt_ggc_mx_lang_tree_node (x_p=0x408865e8) at gtype-cp.h:195
#31 0x08095e89 in gt_ggc_mx_lang_tree_node (x_p=0x408866c0) at gtype-cp.h:158
#32 0x08096302 in gt_ggc_mx_lang_tree_node (x_p=0x4089fb54) at gtype-cp.h:225
#33 0x08096279 in gt_ggc_mx_lang_tree_node (x_p=0x408a021c) at gtype-cp.h:218
#34 0x08095e89 in gt_ggc_mx_lang_tree_node (x_p=0x408a02f4) at gtype-cp.h:158
#35 0x080960fc in gt_ggc_mx_lang_tree_node (x_p=0x408af870) at gtype-cp.h:195
#36 0x08095e89 in gt_ggc_mx_lang_tree_node (x_p=0x408af804) at gtype-cp.h:158
#37 0x0809595e in gt_ggc_mx_cp_binding_level (x_p=0x4026ad14) at gtype-cp.h:68
#38 0x08095b42 in gt_ggc_mx_cxx_binding (x_p=0x4064a500) at gtype-cp.h:94
#39 0x08096910 in gt_ggc_mx_lang_tree_node (x_p=0x40640b40) at gtype-cp.h:330
#40 0x08095ed7 in gt_ggc_mx_lang_tree_node (x_p=0x4064b654) at gtype-cp.h:161
#41 0x080961f7 in gt_ggc_mx_lang_tree_node (x_p=0x4064b6c0) at gtype-cp.h:213
#42 0x08096245 in gt_ggc_mx_lang_tree_node (x_p=0x407c2948) at gtype-cp.h:216
#43 0x08096245 in gt_ggc_mx_lang_tree_node (x_p=0x4087c000) at gtype-cp.h:216
#44 0x08096245 in gt_ggc_mx_lang_tree_node (x_p=0x4087c06c) at gtype-cp.h:216
#45 0x080960e2 in gt_ggc_mx_lang_tree_node (x_p=0x4087c0d8) at gtype-cp.h:194
#46 0x08096320 in gt_ggc_mx_lang_tree_node (x_p=0x4087d140) at gtype-cp.h:226
#47 0x080960fc in gt_ggc_mx_lang_tree_node (x_p=0x4087cdec) at gtype-cp.h:195
#48 0x08095e89 in gt_ggc_mx_lang_tree_node (x_p=0x4087ce58) at gtype-cp.h:158
#49 0x0809595e in gt_ggc_mx_cp_binding_level (x_p=0x4026a21c) at gtype-cp.h:68
#50 0x08095b42 in gt_ggc_mx_cxx_binding (x_p=0x402687d0) at gtype-cp.h:94
#51 0x08096910 in gt_ggc_mx_lang_tree_node (x_p=0x40272780) at gtype-cp.h:330
#52 0x08095ed7 in gt_ggc_mx_lang_tree_node (x_p=0x4026af30) at gtype-cp.h:161
#53 0x080961f7 in gt_ggc_mx_lang_tree_node (x_p=0x4026a5e8) at gtype-cp.h:213
#54 0x080960fc in gt_ggc_mx_lang_tree_node (x_p=0x40274948) at gtype-cp.h:195
#55 0x08095cc3 in gt_ggc_mx_lang_tree_node (x_p=0x40268974) at gtype-cp.h:130
#56 0x08096130 in gt_ggc_mx_lang_tree_node (x_p=0x402749b4) at gtype-cp.h:197
#57 0x08095cc3 in gt_ggc_mx_lang_tree_node (x_p=0x402689b0) at gtype-cp.h:130
#58 0x08096116 in gt_ggc_mx_lang_tree_node (x_p=0x40274c3c) at gtype-cp.h:196
#59 0x08096164 in gt_ggc_mx_lang_tree_node (x_p=0x40274bd0) at gtype-cp.h:199
#60 0x080960e2 in gt_ggc_mx_lang_tree_node (x_p=0x402d5360) at gtype-cp.h:194
#61 0x08095e89 in gt_ggc_mx_lang_tree_node (x_p=0x402d5c3c) at gtype-cp.h:158
#62 0x082fc781 in gt_ggc_mx_cgraph_node (x_p=0x40886000) at gtype-desc.c:87
#63 0x082fb444 in ggc_mark_roots () at ../../../gcc/gcc-mainline/gcc/ggc-common.c:112
#64 0x084c54e2 in ggc_collect () at ../../../gcc/gcc-mainline/gcc/ggc-page.c:1766
#65 0x0817802b in expand_or_defer_fn (fn=0x408b5798)
    at ../../../gcc/gcc-mainline/gcc/cp/semantics.c:2931
#66 0x0812d24d in cp_parser_function_definition_after_declarator (parser=0x40343380,
    inline_p=true) at ../../../gcc/gcc-mainline/gcc/cp/parser.c:13607
#67 0x0812da1e in cp_parser_late_parsing_for_member (parser=0x40343380,
    member_function=0x408b5798) at ../../../gcc/gcc-mainline/gcc/cp/parser.c:13870
#68 0x08129ab1 in cp_parser_class_specifier (parser=0x40343380)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:11326
#69 0x08125b99 in cp_parser_type_specifier (parser=0x40343380,
    flags=CP_PARSER_FLAGS_OPTIONAL, is_friend=false, is_declaration=true,
    declares_class_or_enum=0xbffff140, is_cv_qualifier=0xbffff13f)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:8168
#70 0x0812398a in cp_parser_decl_specifier_seq (parser=0x40343380,
    flags=CP_PARSER_FLAGS_OPTIONAL, attributes=0xbffff174,
    declares_class_or_enum=0xbffff180) at ../../../gcc/gcc-mainline/gcc/cp/parser.c:6382
#71 0x0812d606 in cp_parser_single_declaration (parser=0x40343380, member_p=false,
    friend_p=0xbffff1ab) at ../../../gcc/gcc-mainline/gcc/cp/parser.c:13723
#72 0x0812d370 in cp_parser_template_declaration_after_export (parser=0x40343380,
    member_p=false) at ../../../gcc/gcc-mainline/gcc/cp/parser.c:13660
#73 0x0812460a in cp_parser_template_declaration (parser=0x40343380, member_p=false)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:7213
#74 0x08123445 in cp_parser_declaration (parser=0x40343380)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:5960
#75 0x08123335 in cp_parser_declaration_seq_opt (parser=0x40343380)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:5901
#76 0x081266f0 in cp_parser_namespace_body (parser=0x40343380)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:8915
#77 0x081266c0 in cp_parser_namespace_definition (parser=0x40343380)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:8900
#78 0x081234ed in cp_parser_declaration (parser=0x40343380)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:5987
#79 0x08123335 in cp_parser_declaration_seq_opt (parser=0x40343380)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:5901
#80 0x0811f213 in cp_parser_translation_unit (parser=0x40343380)
    at ../../../gcc/gcc-mainline/gcc/cp/parser.c:2163
#81 0x0812e9f0 in c_parse_file () at ../../../gcc/gcc-mainline/gcc/cp/parser.c:14523
#82 0x081d78b0 in c_common_parse_file (set_yydebug=0)
    at ../../../gcc/gcc-mainline/gcc/c-opts.c:1226
#83 0x0848aeff in compile_file () at ../../../gcc/gcc-mainline/gcc/toplev.c:1792
#84 0x0848f9e1 in do_compile () at ../../../gcc/gcc-mainline/gcc/toplev.c:4482
#85 0x0848fa76 in toplev_main (argc=24, argv=0xbffff3f4)
    at ../../../gcc/gcc-mainline/gcc/toplev.c:4522
#86 0x081db57e in main (argc=0, argv=0x0) at ../../../gcc/gcc-mainline/gcc/main.c:35
#87 0x420156a4 in __libc_start_main () from /lib/tls/libc.so.6


I have no clue what I am doing wrong here,
what is the correct way to extend the number of operands of an expression
without suddenly running into this weird problem?

-- 
Carlo Wood <carlo@alinoe.com>



More information about the Gcc mailing list