diff mbox

Show address operator ('&') in front of strings and functions in dumps

Message ID 55AE328D.1020701@sfr.fr
State New
Headers show

Commit Message

Mikael Morin July 21, 2015, 11:52 a.m. UTC
Hello,

this is a followup to the bug report/patch at:
https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01062.html

It's a fortran quite unimportant bug, so I bet nobody cares.
However, the bug could have been detected when the co_reduce support was 
implemented, if double address operators appeared as '&&some_func' in 
the dump, instead of the rather innocent '&some_func'.

So I propose the attached patch which does that change.
Bootstrapped and regression tested (c,c++,fortran) on x86_64-linux.
OK for trunk?

Mikael
2015-07-21  Mikael Morin  <mikael@gcc.gnu.org>

	* tre-pretty-print.c (dump_generic_node): Don't skip address operators
	in front of strings or procedures.

2015-07-21  Mikael Morin  <mikael@gcc.gnu.org>

	* g++.dg/ipa/devirt-15.C: Add address operator '&' to tree dump pattern.
	* gcc.dg/pr64715.c: Same.
	* gfortran.dg/c_funloc_tests_7.f90: Same.
	* gfortran.dg/co_reduce_1.f90: Same.
	* gfortran.dg/coarray_collectives_16.f90: Same.

Comments

Mikael Morin Aug. 6, 2015, 10:12 a.m. UTC | #1
Le 21/07/2015 13:52, Mikael Morin a écrit :
> Hello,
>
> this is a followup to the bug report/patch at:
> https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01062.html
>
> It's a fortran quite unimportant bug, so I bet nobody cares.
> However, the bug could have been detected when the co_reduce support was
> implemented, if double address operators appeared as '&&some_func' in
> the dump, instead of the rather innocent '&some_func'.
>
> So I propose the attached patch which does that change.
> Bootstrapped and regression tested (c,c++,fortran) on x86_64-linux.
> OK for trunk?
>

Ping: https://gcc.gnu.org/ml/gcc-patches/2015-07/msg01740.html
diff mbox

Patch

Index: testsuite/g++.dg/ipa/devirt-15.C
===================================================================
--- testsuite/g++.dg/ipa/devirt-15.C	(révision 225979)
+++ testsuite/g++.dg/ipa/devirt-15.C	(copie de travail)
@@ -37,4 +37,4 @@  main()
 
 /* { dg-final { scan-ipa-dump "speculatively devirtualizing call" "devirt"} } */
 /* Match if (PROF_6 == foo) to verify that the speculation survived.  */
-/* { dg-final { scan-tree-dump "== foo" "optimized"} } */
+/* { dg-final { scan-tree-dump "== &foo" "optimized"} } */
Index: testsuite/gcc.dg/pr64715-2.c
===================================================================
--- testsuite/gcc.dg/pr64715-2.c	(révision 225979)
+++ testsuite/gcc.dg/pr64715-2.c	(copie de travail)
@@ -15,4 +15,4 @@  foo (int x)
   bar (p, x);
 }
 
-/* { dg-final { scan-tree-dump "__builtin_memcpy \\\(\[^;\n\r\]*, \"abcdefghijkl\", 13\\\);" "optimized" } } */
+/* { dg-final { scan-tree-dump "__builtin_memcpy \\\(\[^;\n\r\]*, &\"abcdefghijkl\", 13\\\);" "optimized" } } */
Index: testsuite/gfortran.dg/c_funloc_tests_7.f90
===================================================================
--- testsuite/gfortran.dg/c_funloc_tests_7.f90	(révision 225979)
+++ testsuite/gfortran.dg/c_funloc_tests_7.f90	(copie de travail)
@@ -16,6 +16,6 @@  cfp = c_funloc (noCsub)
 call c_f_procpointer (cfp, fint)
 end
 
-! { dg-final { scan-tree-dump-times "cfp =\[^;\]+ nocsub;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "cfp =\[^;\]+ &nocsub;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "fint =\[^;\]+ cfp;" 1 "original" } }
 
Index: testsuite/gfortran.dg/co_reduce_1.f90
===================================================================
--- testsuite/gfortran.dg/co_reduce_1.f90	(révision 225979)
+++ testsuite/gfortran.dg/co_reduce_1.f90	(copie de travail)
@@ -30,4 +30,4 @@  contains
 
 end program simple_reduce
 
-! { dg-final { scan-tree-dump "_gfortran_caf_co_reduce \\(&desc\\.\\d+,\\s*simple_reduction," "original" } }
+! { dg-final { scan-tree-dump "_gfortran_caf_co_reduce \\(&desc\\.\\d+,\\s*&simple_reduction," "original" } }
Index: testsuite/gfortran.dg/coarray_collectives_16.f90
===================================================================
--- testsuite/gfortran.dg/coarray_collectives_16.f90	(révision 225979)
+++ testsuite/gfortran.dg/coarray_collectives_16.f90	(copie de travail)
@@ -33,6 +33,6 @@  contains
   end function hc
 end program test
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., &fr, 4, _gfortran_caf_num_images \\(0, -1\\), &stat1, errmesg1, 0, 6\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&val2, &gz, 0, 4, &stat2, errmesg2, 0, 7\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_co_reduce \\(&desc.., &hc, 1, res, &stat3, errmesg3, 99, 8\\);" 1 "original" } }
Index: tree-pretty-print.c
===================================================================
--- tree-pretty-print.c	(révision 225979)
+++ tree-pretty-print.c	(copie de travail)
@@ -2060,12 +2060,7 @@  dump_generic_node (pretty_printer *pp, tree node,
     case PREDECREMENT_EXPR:
     case PREINCREMENT_EXPR:
     case INDIRECT_REF:
-      if (TREE_CODE (node) == ADDR_EXPR
-	  && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST
-	      || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL))
-	;	/* Do not output '&' for strings and function pointers.  */
-      else
-	pp_string (pp, op_symbol (node));
+      pp_string (pp, op_symbol (node));
 
       if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
 	{