On 12 Sep 2014, at 22:52, Andrey Chernov <a...@freebsd.org> wrote:
> On 13.09.2014 0:44, Andrey Chernov wrote:
>> On 12.09.2014 22:40, Andrey Chernov wrote:
>>> I don't have -current & i386 combination, but I can try -current & x64 
>>> later (with different -march).
>> 
>> It works on -current, amd64, -march=core2. So it either -stable or
>> i386-specific clang bug.
>> 
> 
> I forget to say that real CPU on -current tested is not the same as for
> failing i386: QuadCore Intel Core i7-3820

After some massaging of gcc's source to disable its built-in segfault
handlers, I get this backtrace:

Program received signal SIGSEGV, Segmentation fault.
find_parameter_packs_r (tp=0x2c3212fc, walk_subtrees=0xbfbfda60, 
data=0xbfbfdb58) at .././../gcc-4.8.3/gcc/cp/pt.c:3063
3063      if (TYPE_P (t)
(gdb) bt
#0  find_parameter_packs_r (tp=0x2c3212fc, walk_subtrees=0xbfbfda60, 
data=0xbfbfdb58) at .././../gcc-4.8.3/gcc/cp/pt.c:3063
#1  0x086a111c in walk_tree_1 (tp=<optimized out>, func=<optimized out>, 
data=<optimized out>, pset=0x295e00a0, lh=<optimized out>) at 
.././../gcc-4.8.3/gcc/tree.c:10700
#2  0x086a15f6 in walk_tree_1 (tp=<optimized out>, func=<optimized out>, 
data=<optimized out>, pset=0x295e00a0, lh=<optimized out>) at 
.././../gcc-4.8.3/gcc/tree.c:10954
#3  0x086a1555 in walk_tree_1 (tp=<optimized out>, func=<optimized out>, 
data=<optimized out>, pset=<optimized out>, lh=<optimized out>) at 
.././../gcc-4.8.3/gcc/tree.c:10747
#4  0x081ed0ef in cp_walk_subtrees (tp=0xbfbfdb68, walk_subtrees_p=0x29401674, 
func=<optimized out>, data=<optimized out>, pset=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/tree.c:3522
#5  0x086a118c in walk_tree_1 (tp=<optimized out>, func=<optimized out>, 
data=<optimized out>, pset=<optimized out>, lh=<optimized out>) at 
.././../gcc-4.8.3/gcc/tree.c:10723
#6  0x0813b6fc in check_for_bare_parameter_packs (t=0x2c388514) at 
.././../gcc-4.8.3/gcc/cp/pt.c:3357
#7  0x081c4707 in check_return_expr (retval=0x2c388514, no_warning=<optimized 
out>) at .././../gcc-4.8.3/gcc/cp/typeck.c:8156
#8  0x081da7b9 in finish_return_stmt (expr=0x2c388514) at 
.././../gcc-4.8.3/gcc/cp/semantics.c:793
#9  0x0819a799 in cp_parser_jump_statement (parser=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/parser.c:10150
#10 cp_parser_statement (parser=0x298ea1c0, in_statement_expr=0x0, 
in_compound=<optimized out>, if_p=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/parser.c:8877
#11 0x081990c8 in cp_parser_statement_seq_opt (parser=0x298ea1c0, 
in_statement_expr=0x0) at .././../gcc-4.8.3/gcc/cp/parser.c:9241
#12 0x08198f5f in cp_parser_compound_statement (parser=<optimized out>, 
in_statement_expr=<optimized out>, in_try=<optimized out>, 
function_body=<optimized out>) at .././../gcc-4.8.3/gcc/cp/parser.c:9195
#13 0x0819dd96 in cp_parser_implicitly_scoped_statement (parser=<optimized 
out>, if_p=<optimized out>) at .././../gcc-4.8.3/gcc/cp/parser.c:10237
#14 0x0819a8e4 in cp_parser_selection_statement (parser=0x298ea1c0, if_p=0x0) 
at .././../gcc-4.8.3/gcc/cp/parser.c:9347
#15 cp_parser_statement (parser=0x298ea1c0, in_statement_expr=0x0, 
in_compound=<optimized out>, if_p=0x0) at .././../gcc-4.8.3/gcc/cp/parser.c:8864
#16 0x0819ddbb in cp_parser_implicitly_scoped_statement (parser=<optimized 
out>, if_p=<optimized out>) at .././../gcc-4.8.3/gcc/cp/parser.c:10244
#17 0x0819a8e4 in cp_parser_selection_statement (parser=0x298ea1c0, if_p=0x0) 
at .././../gcc-4.8.3/gcc/cp/parser.c:9347
#18 cp_parser_statement (parser=0x298ea1c0, in_statement_expr=0x0, 
in_compound=<optimized out>, if_p=0x0) at .././../gcc-4.8.3/gcc/cp/parser.c:8864
#19 0x081990c8 in cp_parser_statement_seq_opt (parser=0x298ea1c0, 
in_statement_expr=0x0) at .././../gcc-4.8.3/gcc/cp/parser.c:9241
#20 0x0819dbfe in cp_parser_already_scoped_statement (parser=0x298ea1c0) at 
.././../gcc-4.8.3/gcc/cp/parser.c:10273
#21 0x0819a045 in cp_parser_iteration_statement (parser=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/parser.c:9938
#22 cp_parser_statement (parser=0x298ea1c0, in_statement_expr=0x0, 
in_compound=<optimized out>, if_p=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/parser.c:8870
#23 0x081990c8 in cp_parser_statement_seq_opt (parser=0x298ea1c0, 
in_statement_expr=0x0) at .././../gcc-4.8.3/gcc/cp/parser.c:9241
#24 0x08198f5f in cp_parser_compound_statement (parser=<optimized out>, 
in_statement_expr=<optimized out>, in_try=<optimized out>, 
function_body=<optimized out>) at .././../gcc-4.8.3/gcc/cp/parser.c:9195
#25 0x08198e33 in cp_parser_function_body (parser=<optimized out>, 
parser=<optimized out>, in_function_try_block=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/parser.c:17816
#26 cp_parser_ctor_initializer_opt_and_function_body (parser=0x298ea1c0, 
in_function_try_block=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/parser.c:17852
#27 0x08198a14 in cp_parser_function_definition_after_declarator 
(parser=0x298ea1c0, inline_p=false) at .././../gcc-4.8.3/gcc/cp/parser.c:21831
#28 0x08183dcb in cp_parser_function_definition_from_specifiers_and_declarator 
(parser=<optimized out>, decl_specifiers=<optimized out>, attributes=<optimized 
out>, declarator=<optimized out>) at .././../gcc-4.8.3/gcc/cp/parser.c:21752
#29 cp_parser_init_declarator (parser=0x298ea1c0, decl_specifiers=<optimized 
out>, checks=<optimized out>, function_definition_allowed_p=<optimized out>, 
member_p=<optimized out>, declares_class_or_enum=<optimized out>, 
function_definition_p=<optimized out>, maybe_range_for_decl=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/parser.c:15905
#30 0x081abc32 in cp_parser_single_declaration (parser=0x298ea1c0, checks=0x0, 
member_p=<optimized out>, explicit_specialization_p=false, friend_p=<optimized 
out>) at .././../gcc-4.8.3/gcc/cp/parser.c:22127
#31 0x081ab137 in cp_parser_template_declaration_after_export 
(parser=0x298ea1c0, member_p=false) at .././../gcc-4.8.3/gcc/cp/parser.c:21941
#32 0x0817d57e in cp_parser_template_declaration (parser=0x298ea1c0, 
member_p=false) at .././../gcc-4.8.3/gcc/cp/parser.c:12226
#33 cp_parser_declaration (parser=0x298ea1c0) at 
.././../gcc-4.8.3/gcc/cp/parser.c:10404
#34 0x0817b387 in cp_parser_declaration_seq_opt (parser=0x298ea1c0) at 
.././../gcc-4.8.3/gcc/cp/parser.c:10334
#35 0x0817e3a7 in cp_parser_namespace_body (parser=0x298ea1c0) at 
.././../gcc-4.8.3/gcc/cp/parser.c:15136
#36 cp_parser_namespace_definition (parser=0x298ea1c0) at 
.././../gcc-4.8.3/gcc/cp/parser.c:15117
#37 0x0817d4f8 in cp_parser_declaration (parser=0x298ea1c0) at 
.././../gcc-4.8.3/gcc/cp/parser.c:10432
#38 0x0817b387 in cp_parser_declaration_seq_opt (parser=0x298ea1c0) at 
.././../gcc-4.8.3/gcc/cp/parser.c:10334
#39 0x0817a4b2 in cp_parser_translation_unit (parser=<optimized out>) at 
.././../gcc-4.8.3/gcc/cp/parser.c:3813
#40 c_parse_file () at .././../gcc-4.8.3/gcc/cp/parser.c:28334
#41 0x0824a304 in c_common_parse_file () at 
.././../gcc-4.8.3/gcc/c-family/c-opts.c:1052
#42 0x0853aca8 in compile_file () at .././../gcc-4.8.3/gcc/toplev.c:547
#43 0x0853aac3 in do_compile () at .././../gcc-4.8.3/gcc/toplev.c:1870
#44 toplev_main (argc=43, argv=0xbfbfe1ec) at 
.././../gcc-4.8.3/gcc/toplev.c:1946
#45 0x0810e6aa in _start1 ()
#46 0x0810e568 in _start ()
(gdb) list
3058      struct find_parameter_pack_data* ppd = 
3059        (struct find_parameter_pack_data*)data;
3060      bool parameter_pack_p = false;
3061    
3062      /* Handle type aliases/typedefs.  */
3063      if (TYPE_P (t)
3064          && TYPE_NAME (t)
3065          && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL
3066          && TYPE_DECL_ALIAS_P (TYPE_NAME (t)))
3067        {
(gdb) print t
$1 = (tree) 0x8
(gdb) print tp
$2 = (tree *) 0x2c3212fc
(gdb) print *tp
$3 = (tree) 0x8

I think it's most likely this is some type of undefined behavior in gcc,
which leads to randomly corrupted tree values.  Of course, it could also
be a clang bug, but I don't see any "64-bit" instructions in there at
all.

This needs to be investigated further, but it's very hard to understand
what is going on the guts of gcc's parser.  Let alone to reduce this to
some sort of reproducible test case.

-Dimitry

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to