[Bug middle-end/54287] New: -finstrument-functions-exclude-function-list ignores class/namespace scope

2012-08-16 Thread mg1102 at web dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54287

 Bug #: 54287
   Summary: -finstrument-functions-exclude-function-list ignores
class/namespace scope
Classification: Unclassified
   Product: gcc
   Version: 4.7.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: mg1...@web.de


In it's current implementation, the symbol matching of
-finstrument-functions-exclude-function-list performs a strstr() on the
function name only, ignoring the class/namespace scope. That is, with sym=func,
both foo::func() and bar::func() with foo and bar being either classes or
namespaces will be matched and excluded from instrumentation.

To allow for a more fine-grained specification, the function name used for
matching should include the class/namespace scope. This can easily be achived
using the patch given below (against the 4.7.1 release). A matching based on
regular expressions would be even more convenient, but the proposed change
would already help a lot.


diff -Nrup gcc-4.7.1.orig/gcc/gimplify.c gcc-4.7.1/gcc/gimplify.c
--- gcc-4.7.1.orig/gcc/gimplify.c2012-05-10 17:00:11.0 +0200
+++ gcc-4.7.1/gcc/gimplify.c2012-08-16 18:12:45.793020996 +0200
@@ -8079,7 +8079,7 @@ flag_instrument_functions_exclude_p (tre
   int i;
   char *s;

-  name = lang_hooks.decl_printable_name (fndecl, 0);
+  name = lang_hooks.decl_printable_name (fndecl, 1);
   FOR_EACH_VEC_ELT (char_p, vec, i, s)
 if (strstr (name, s) != NULL)
   return true;


[Bug fortran/53993] New: gfortran ignores file part of #line directives

2012-07-17 Thread mg1102 at web dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53993

 Bug #: 53993
   Summary: gfortran ignores file part of #line directives
Classification: Unclassified
   Product: gcc
   Version: 4.7.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: mg1...@web.de


Created attachment 27810
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27810
Example files to reproduce bug

#line directives inserted by source-code preprocessors are only partially
handled by gfortran. The line number part is OK, the file name part is ignored
and the input file name is used instead. This can mess up the debug information
of preprocessed Fortran files.

Example:
- The file 'dummy.f90' in the attached tar archive provides a simple Fortran
  code, calling a subroutine from the main program which prints "Hello world!".
  Compilation with gfortran 4.7.1 yields the following result:

  % gfortran -g -c dummy.f90
  % nm -l dummy.o
  006d t MAIN__/tmp/bug/dummy.f90:1
   U _gfortran_set_args/tmp/bug/dummy.f90:3
   U _gfortran_set_options/tmp/bug/dummy.f90:3
   U _gfortran_st_write/tmp/bug/dummy.f90:6
   U _gfortran_st_write_done/tmp/bug/dummy.f90:6
   U _gfortran_transfer_character_write/tmp/bug/dummy.f90:6
   T foo_/tmp/bug/dummy.f90:5
  0078 T main/tmp/bug/dummy.f90:3
  0020 r options.1.1854

- Suppose a source-code preprocessor inserts write statements to mark the
  begin and end of the main program as well as #line directives to account
  for modified line numbers and file name (prospective output provided as
  'dummy.mod.F90').

  % gfortran -g -c dummy.mod.F90
  % nm -l dummy.mod.o
  006d t MAIN__/tmp/bug/dummy.mod.F90:1
   U _gfortran_set_args/tmp/bug/dummy.mod.F90:3
   U _gfortran_set_options/tmp/bug/dummy.mod.F90:3
   U _gfortran_st_write/tmp/bug/dummy.mod.F90:6
   U _gfortran_st_write_done/tmp/bug/dummy.mod.F90:6
   U _gfortran_transfer_character_write   
/tmp/bug/dummy.mod.F90:6
   T foo_/tmp/bug/dummy.mod.F90:5
  013f T main/tmp/bug/dummy.mod.F90:3
  0040 r options.3.1856

- As can be seen, the line number information provided by the #line directives
  is handled correctly, however, the file name refers to the actual input file
  instead of the file specified by the directive.

This bug seems to only affect Fortran, similar examples in C/C++ work fine.
This behavior has been verified with GCC 4.5.3, 4.6.2 and 4.7.1.


[Bug middle-end/48704] ICE: gfortran dies when '-finstrument-functions' option is used

2011-11-23 Thread mg1102 at web dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48704

Markus Geimer  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||DUPLICATE

--- Comment #2 from Markus Geimer  2011-11-23 09:26:35 
UTC ---
Duplicate of bug 49675 which is fixed for 4.6.2.

*** This bug has been marked as a duplicate of bug 49675 ***


[Bug middle-end/49675] [4.6/4.7 Regression] ICE (segfault) with -finstrument-functions

2011-11-23 Thread mg1102 at web dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49675

Markus Geimer  changed:

   What|Removed |Added

 CC||mg1102 at web dot de

--- Comment #8 from Markus Geimer  2011-11-23 09:26:35 
UTC ---
*** Bug 48704 has been marked as a duplicate of this bug. ***


[Bug fortran/48704] New: ICE: gfortran dies when '-finstrument-functions' option is used

2011-04-20 Thread mg1102 at web dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48704

   Summary: ICE: gfortran dies when '-finstrument-functions'
option is used
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: mg1...@web.de


Created attachment 24063
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24063
Preprocesses input file, generated by '-save-temps'

When compiling the attached source file with gfortran 4.6.0 and the
'-finstrument-functions' option specified, gfortran dies with a SIGSEGV.
Without the option and with previous versions of the compiler (e.g., 4.5.2),
compilation works fine.


DETAILS
===
$ gfortran -v -save-temps -finstrument-functions -c jacobi.F90
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/packages/gcc/4.6.0/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.6.0/configure --prefix=/opt/packages/gcc/4.6.0
--enable-languages=c,c++,fortran --enable-__cxa_atexit --enable-threads
--disable-multilib
Thread model: posix
gcc version 4.6.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-finstrument-functions' '-c'
'-mtune=generic' '-march=pentiumpro'
 /opt/packages/gcc/4.6.0/libexec/gcc/i686-pc-linux-gnu/4.6.0/f951 jacobi.F90
-cpp=jacobi.f90 -quiet -v jacobi.F90 -quiet -dumpbase jacobi.F90 -mtune=generic
-march=pentiumpro -auxbase jacobi -version -finstrument-functions
-fintrinsic-modules-path
/opt/packages/gcc/4.6.0/lib/gcc/i686-pc-linux-gnu/4.6.0/finclude -o jacobi.s
GNU Fortran (GCC) version 4.6.0 (i686-pc-linux-gnu)
compiled by GNU C version 4.6.0, GMP version 4.3.2, MPFR version 2.4.2, MPC
version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/opt/packages/gcc/4.6.0/lib/gcc/i686-pc-linux-gnu/4.6.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/packages/gcc/4.6.0/lib/gcc/i686-pc-linux-gnu/4.6.0/finclude
 /opt/packages/gcc/4.6.0/lib/gcc/i686-pc-linux-gnu/4.6.0/include
 /usr/local/include
 /opt/packages/gcc/4.6.0/include
 /opt/packages/gcc/4.6.0/lib/gcc/i686-pc-linux-gnu/4.6.0/include-fixed
 /usr/include
End of search list.
GNU Fortran (GCC) version 4.6.0 (i686-pc-linux-gnu)
compiled by GNU C version 4.6.0, GMP version 4.3.2, MPFR version 2.4.2, MPC
version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
jacobi.F90: In function 'jacobi':
jacobi.F90:137:0: internal compiler error: Segmentation fault


STEP TO REPRODUCE
=
$ gfortran -finstrument-functions -c jacobi.f90