This is the mail archive of the gcc-patches@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]

Re: [PATCH] Fix proc_ptr_23.f90 etc. failures (PR debug/44112)


On Thu, May 13, 2010 at 05:07:25PM -0400, Jason Merrill wrote:
> On 05/13/2010 10:57 AM, Jakub Jelinek wrote:
> >    if (GET_CODE (rtl) == SYMBOL_REF
> >        &&  SYMBOL_REF_DECL (rtl)
> >-&&  TREE_CODE (SYMBOL_REF_DECL (rtl)) == VAR_DECL
> >+&&  (TREE_CODE (SYMBOL_REF_DECL (rtl)) == VAR_DECL
> >+	  || TREE_CODE (SYMBOL_REF_DECL (rtl)) == FUNCTION_DECL)
> >        &&  !TREE_ASM_WRITTEN (SYMBOL_REF_DECL (rtl)))
> 
> Should we just drop the TREE_CODE check?  What other sort of DECL
> could a SYMBOL_REF refer to?

I've added extra asserts in a test bootstrap/regtest and
on both x86_64-linux and i686-linux only VAR_DECLs and FUNCTION_DECLs
show up there (and in both bootstraps/regtests together,
FUNCTION_DECL was there with !TREE_ASM_WRITTEN in ~ 60 cases).

Unfortunately, two of them are in debug/dwarf2/const*1* -
the function mentioned there isn't in current CU, but in some other
with hidden visibility.

Either we just don't care about that case and remove it from debug info
as does the patch below, or we could perhaps if the referenced
VAR_DECL or FUNCTION_DECL is DECL_EXTERNAL and targetm.binds_local_p.
The advantage is slightly better debug info, disadvantage is that it
means that the function or var really has to be defined elsewhere
even when all real references have been optimized out.
So, perhaps this patch is really better:

2010-05-14  Jakub Jelinek  <jakub@redhat.com>

	PR debug/44112
	* dwarf2out.c (resolve_one_addr): Check TREE_ASM_WRITTEN
	for all SYMBOL_REF_DECLs.

	* gcc.dg/debug/dwarf2/const-1.c: Remove.
	* g++.dg/debug/dwarf2/const1.C: Remove.

--- gcc/dwarf2out.c.jj	2010-05-13 16:33:10.000000000 +0200
+++ gcc/dwarf2out.c	2010-05-13 23:36:24.000000000 +0200
@@ -21611,7 +21611,6 @@ resolve_one_addr (rtx *addr, void *data 
 
   if (GET_CODE (rtl) == SYMBOL_REF
       && SYMBOL_REF_DECL (rtl)
-      && TREE_CODE (SYMBOL_REF_DECL (rtl)) == VAR_DECL
       && !TREE_ASM_WRITTEN (SYMBOL_REF_DECL (rtl)))
     return 1;
 
--- gcc/testsuite/gcc.dg/debug/dwarf2/const-1.c.jj	2010-01-18 17:13:01.000000000 +0100
+++ gcc/testsuite/gcc.dg/debug/dwarf2/const-1.c	2010-05-14 16:24:47.000000000 +0200
@@ -1,7 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O -gdwarf-2 -dA -gno-strict-dwarf -fno-merge-debug-strings" } */
-/* { dg-require-visibility "" } */
-/* { dg-final { scan-assembler "DW_AT_location\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*DW_OP_addr\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*fnx\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*DW_OP_stack_value" } } */
-
-extern void fnx() __attribute__((visibility("hidden")));
-static void (*f)() = fnx;
--- gcc/testsuite/g++.dg/debug/dwarf2/const1.C.jj	2010-01-18 17:12:48.000000000 +0100
+++ gcc/testsuite/g++.dg/debug/dwarf2/const1.C	2010-05-14 16:25:12.000000000 +0200
@@ -1,7 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-O -gdwarf-2 -dA -gno-strict-dwarf -fno-merge-debug-strings" } */
-/* { dg-require-visibility "" } */
-/* { dg-final { scan-assembler "DW_AT_location\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*DW_OP_addr\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*fnx\[^\\r\\n\]*\[\\r\\n\]*\[^\\r\\n\]*DW_OP_stack_value" } } */
-
-extern void fnx () __attribute__((visibility ("hidden")));
-void (* const f) () = fnx;


	Jakub


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