public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53993] New: gfortran ignores file part of #line directives
@ 2012-07-17 10:54 mg1102 at web dot de
  2012-07-17 11:55 ` [Bug fortran/53993] gfortran ignores file part of #line directives for debugging burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mg1102 at web dot de @ 2012-07-17 10:54 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: mg1102@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
  000000000000006d 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
  0000000000000000 T foo_    /tmp/bug/dummy.f90:5
  0000000000000078 T main    /tmp/bug/dummy.f90:3
  0000000000000020 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
  000000000000006d 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
  0000000000000000 T foo_    /tmp/bug/dummy.mod.F90:5
  000000000000013f T main    /tmp/bug/dummy.mod.F90:3
  0000000000000040 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-18  9:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-17 10:54 [Bug fortran/53993] New: gfortran ignores file part of #line directives mg1102 at web dot de
2012-07-17 11:55 ` [Bug fortran/53993] gfortran ignores file part of #line directives for debugging burnus at gcc dot gnu.org
2012-07-17 12:38 ` burnus at gcc dot gnu.org
2012-07-17 15:53 ` burnus at gcc dot gnu.org
2012-07-18  9:29 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).