Bug 68385

Summary: [6 Regression] ICE building libstdc++ on arm-none-eabi
Product: gcc Reporter: Alan Lawrence <alan.lawrence.arm>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: belagod, christian.joensson, jakub, jason, webrown.cpp
Priority: P3    
Version: 6.0   
Target Milestone: 6.0   
See Also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68346
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68361
Host: Target: arm-none-eabi
Build: Known to work:
Known to fail: Last reconfirmed: 2015-11-18 00:00:00
Attachments: Reduced testcase

Description Alan Lawrence 2015-11-17 14:07:45 UTC
Created attachment 36738 [details]
Reduced testcase

Starting with r230365, building gcc for arm-none-eabi falls over in libstdc++ with:

/work/alalaw01/build-arm-none-eabi/obj/gcc2/./gcc/xgcc -shared-libgcc -B/work/alalaw01/build-arm-none-eabi/obj/gcc2/./gcc -nostdinc++ -L/work/alalaw01/build-arm-none-eabi/obj/gcc2/arm-none-eabi/libstdc++-v3/src -L/work/alalaw01/build-arm-none-eabi/obj/gcc2/arm-none-eabi/libstdc++-v3/src/.libs -L/work/alalaw01/build-arm-none-eabi/obj/gcc2/arm-none-eabi/libstdc++-v3/libsupc++/.libs -B/work/alalaw01/build-arm-none-eabi/install/arm-none-eabi/bin/ -B/work/alalaw01/build-arm-none-eabi/install/arm-none-eabi/lib/ -isystem /work/alalaw01/build-arm-none-eabi/install/arm-none-eabi/include -isystem /work/alalaw01/build-arm-none-eabi/install/arm-none-eabi/sys-include -I/work/alalaw01/src/gcc/libstdc++-v3/../libgcc -I/work/alalaw01/build-arm-none-eabi/obj/gcc2/arm-none-eabi/libstdc++-v3/include/arm-none-eabi -I/work/alalaw01/build-arm-none-eabi/obj/gcc2/arm-none-eabi/libstdc++-v3/include -I/work/alalaw01/src/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=eh_personality.lo -O2 -g -c /work/alalaw01/src/gcc/libstdc++-v3/libsupc++/eh_personality.cc -o eh_personality.o
/work/alalaw01/src/gcc/libstdc++-v3/libsupc++/eh_personality.cc: In function '_Unwind_Reason_Code __cxxabiv1::__gxx_personality_v0(_Unwind_State, _Unwind_Control_Block*, _Unwind_Context*)':
/work/alalaw01/src/gcc/libstdc++-v3/libsupc++/eh_personality.cc:394:26: internal compiler error: tree check: expected integer_cst, have nop_expr in decompose, at tree.h:5123
          UNWIND_STACK_REG))
                          ^

0xf8d589 tree_check_failed(tree_node const*, char const*, int, char const*, ...)
	/work/alalaw01/src/gcc/gcc/tree.c:9587
0x10df3fd tree_check
	/work/alalaw01/src/gcc/gcc/tree.h:3212
0x10df3fd wi::int_traits<tree_node const*>::decompose(long*, unsigned int, tree_node const*)
	/work/alalaw01/src/gcc/gcc/tree.h:5123
0x10df3fd wide_int_ref_storage<tree_node*>
	/work/alalaw01/src/gcc/gcc/wide-int.h:936
0x10df3fd generic_wide_int<tree_node*>
	/work/alalaw01/src/gcc/gcc/wide-int.h:714
0x10df3fd generic_simplify_172
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:6142
0x1113507 generic_simplify_EQ_EXPR
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:22841
0x111d719 generic_simplify(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:25312
0xa182c8 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/src/gcc/gcc/fold-const.c:9138
0xa227b2 fold_build2_stat_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/src/gcc/gcc/fold-const.c:12333
0x10e00cd generic_simplify_46
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:2014
0x1112b27 generic_simplify_EQ_EXPR
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:22441
0x111d719 generic_simplify(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:25312
0xa182c8 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/src/gcc/gcc/fold-const.c:9138
0xa3ec75 fold(tree_node*)
	/work/alalaw01/src/gcc/gcc/fold-const.c:11973
0x5bdff3 build_new_op_1
	/work/alalaw01/src/gcc/gcc/cp/call.c:5730
0x5be299 build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int)
	/work/alalaw01/src/gcc/gcc/cp/call.c:5803
0x70f42f build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int)
	/work/alalaw01/src/gcc/gcc/cp/typeck.c:3828
0x6e3b39 cp_parser_binary_expression
	/work/alalaw01/src/gcc/gcc/cp/parser.c:8621
0x6e3cdc cp_parser_assignment_expression
	/work/alalaw01/src/gcc/gcc/cp/parser.c:8742
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Reduced testcase attached:

$ arm-none-eabi-gcc -c reduced.cc
reduced.cc: In function 'bool __gxx_personality_v0(_Unwind_State, _Unwind_Control_Block*, _Unwind_Context*)':
reduced.cc:19:63: internal compiler error: tree check: expected integer_cst, have nop_expr in decompose, at tree.h:5123
    && ue_header->barrier_cache.sp == _Unwind_GetGR(context, 13));
                                                               ^

0xf8d589 tree_check_failed(tree_node const*, char const*, int, char const*, ...)
	/work/alalaw01/src/gcc/gcc/tree.c:9587
0x10df3fd tree_check
	/work/alalaw01/src/gcc/gcc/tree.h:3212
0x10df3fd wi::int_traits<tree_node const*>::decompose(long*, unsigned int, tree_node const*)
	/work/alalaw01/src/gcc/gcc/tree.h:5123
0x10df3fd wide_int_ref_storage<tree_node*>
	/work/alalaw01/src/gcc/gcc/wide-int.h:936
0x10df3fd generic_wide_int<tree_node*>
	/work/alalaw01/src/gcc/gcc/wide-int.h:714
0x10df3fd generic_simplify_172
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:6142
0x1113507 generic_simplify_EQ_EXPR
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:22841
0x111d719 generic_simplify(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:25312
0xa182c8 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/src/gcc/gcc/fold-const.c:9138
0xa227b2 fold_build2_stat_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/src/gcc/gcc/fold-const.c:12333
0x10e00cd generic_simplify_46
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:2014
0x1112b27 generic_simplify_EQ_EXPR
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:22441
0x111d719 generic_simplify(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/build-arm-none-eabi/obj/gcc2/gcc/generic-match.c:25312
0xa182c8 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/work/alalaw01/src/gcc/gcc/fold-const.c:9138
0xa3ec75 fold(tree_node*)
	/work/alalaw01/src/gcc/gcc/fold-const.c:11973
0x5bdff3 build_new_op_1
	/work/alalaw01/src/gcc/gcc/cp/call.c:5730
0x5be299 build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int)
	/work/alalaw01/src/gcc/gcc/cp/call.c:5803
0x70f42f build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int)
	/work/alalaw01/src/gcc/gcc/cp/typeck.c:3828
0x6e3b39 cp_parser_binary_expression
	/work/alalaw01/src/gcc/gcc/cp/parser.c:8621
0x6e3cdc cp_parser_assignment_expression
	/work/alalaw01/src/gcc/gcc/cp/parser.c:8742
Comment 1 Tejas Belagod 2015-11-18 15:20:04 UTC
Confirmed on arm-none-eabi with r230540.
Comment 2 Andre Vieira 2015-11-18 15:45:40 UTC
Hi Jason,

I don't fully understand what is going wrong here, but when debugging I found that the tree it complains about is coming from a call to convert_to_integer_nofold in  the line in ocp_convert, this used to have a fold_if_not_in_template. I found that I no longer got the ICE after reverting the code there to fold 'converted'. Not sure this actually fixes it, I'd need to look further into your patch for this. Hopefully this saves you some debugging yourself.

The issue seemed to originate from a nop_expr around a param_declaration and fold gets rid of it.

Hope this helps.

Cheers,
Andre
Comment 3 Jason Merrill 2015-11-25 14:35:55 UTC
Author: jason
Date: Wed Nov 25 14:35:24 2015
New Revision: 230871

URL: https://gcc.gnu.org/viewcvs?rev=230871&root=gcc&view=rev
Log:
	PR c++/68385

	* tree.c (integer_zerop, integer_onep, integer_each_onep)
	(integer_all_onesp, integer_minus_onep, integer_pow2p)
	(integer_nonzerop, integer_truep, tree_log2, tree_floor_log2)
	(real_zerop, real_onep, real_minus_onep): Remove STRIP_NOPS.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree.c
Comment 4 Christophe Lyon 2015-11-25 17:11:01 UTC
*** Bug 68368 has been marked as a duplicate of this bug. ***
Comment 5 chrbr 2015-11-26 15:10:52 UTC
*** Bug 68368 has been marked as a duplicate of this bug. ***
Comment 6 Jakub Jelinek 2015-12-18 11:33:45 UTC
So, is this fixed now?
Comment 7 Richard Biener 2016-01-14 11:20:38 UTC
Let's just assume that.
Comment 8 Andre Vieira 2016-01-15 16:57:35 UTC
It did fix it for me, sorry for the late reply.