[RFC] Fix for PR58201

Jan Hubicka hubicka@ucw.cz
Sat Sep 7 08:04:00 GMT 2013


> >+ 2013-09-04  Jan Hubicka  <jh@suse.cz>
> >+
> >+ 	PR middle-end/58201
> >+ 	* cgraphunit.c (analyze_functions): Clear AUX fields
> >+ 	after processing; initialize assembler name has.
> >+
> I checked and double checked and with this commit a C++ test regressed:
> 
> FAIL: g++.dg/template/cond2.C -std=gnu++98 (test for warnings, line 9)
> FAIL: g++.dg/template/cond2.C -std=gnu++11 (test for warnings, line 9)
> 
> In practice we emit a message off by one line, line 10 instead of
> the correct line 9. Is it possible that you are clearing too much,
> so to speak?

Amazing, this testcase was triggering an ICE and I had to disable initialization
of assembler name hash when error arrived.  That fixed the problem, but I did not
notice it is still having wrong line info.

Adding an alias into the unit will trigger wrong line info before my change, since
assembler name hash is populated too.

The error is output from DECL_ASSEMBLER_NAME hook that by itself is strange.

#0  0x0000000001041490 in error(char const*, ...) ()
#1  0x0000000000735039 in write_expression(tree_node*) () at ../../gcc/cp/mangle.c:3008
#2  0x000000000073a70f in write_template_arg(tree_node*) () at ../../gcc/cp/mangle.c:3179
#3  0x000000000073ae69 in write_template_args(tree_node*) () at ../../gcc/cp/mangle.c:2551
#4  0x00000000007332a4 in write_name(tree_node*, int) () at ../../gcc/cp/mangle.c:821
#5  0x000000000073700c in write_type(tree_node*) () at ../../gcc/cp/mangle.c:2522
#6  0x0000000000737279 in write_type(tree_node*) () at ../../gcc/cp/mangle.c:2017
#7  0x0000000000738a18 in write_method_parms(tree_node*, int, tree_node*) () at ../../gcc/cp/mangle.c:2509
#8  0x0000000000738e2f in write_bare_function_type(tree_node*, int, tree_node*) () at ../../gcc/cp/mangle.c:2451
#9  0x0000000000733b9e in write_mangled_name(tree_node*, bool) () at ../../gcc/cp/mangle.c:689
#10 0x000000000073c5b6 in mangle_decl_string(tree_node*) () at ../../gcc/cp/mangle.c:3446
#11 0x000000000073c7e9 in mangle_decl(tree_node*) () at ../../gcc/cp/mangle.c:3468
#12 0x0000000000d1df01 in decl_assembler_name(tree_node*) () at ../../gcc/tree.c:546
#13 0x000000000083b1f5 in insert_to_assembler_name_hash(symtab_node_def*, bool) ()
#14 0x000000000083b352 in symtab_initialize_asm_name_hash() [clone .part.3] ()

It seems to be latent bug in C++ FE to not set location correctly to error - no one
promise that the current locus will correspond to the declaration being mangled
during the lazy call of assembler name.  So I suppose error needs to be updated
to get correct locus?

Honza

> 
> After the recent breakages, up to date testresults are arriving only
> now on gcc-testresults confirming my finding, for example Andreas
> Schwab already posted a couple.
> 
> Thanks!
> Paolo.



More information about the Gcc-patches mailing list