http://gcc.gnu.org/ml/fortran/2008-05/msg00354.html, issue 3:

If I compile the following a.F90 file:

# 1 "a.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.F90"
  print *, "foo"  "bar""gee"
  end

with "gfortran -E", I get garbage in the output:

# 1 "a.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.F90"
# 1 "a.F90*"
# 1 "<built-in>&#2026;&#9618;*"
# 1 "<command-line>"
# 1 "a.F90*"
  print *, "foo"  "bar""gee"
  end

and valgrind says:

==28934== Invalid read of size 1
==28934==    at 0x4A1C713: strlen (mc_replace_strmem.c:246)
==28934==    by 0x410D99: print_line (cpp.c:753)
==28934==    by 0xB53574: do_linemarker (directives.c:993)
==28934==    by 0xB51F98: _cpp_handle_directive (directives.c:483)
==28934==    by 0xB624DE: _cpp_scan_out_logical_line (traditional.c:634)
==28934==    by 0xB62BF6: _cpp_read_logical_line_trad (traditional.c:305)
==28934==    by 0x41105F: gfc_cpp_preprocess (cpp.c:699)
==28934==    by 0x46FB35: gfc_new_file (scanner.c:1916)
==28934==    by 0x48720C: gfc_init (f95-lang.c:295)
==28934==    by 0x704A88: toplev_main (toplev.c:2045)
==28934==    by 0x4B3B4C9: (below main) (in /usr/lib/debug/libc-2.3.6.so)
==28934==  Address 0x4E2C13D is 0 bytes after a block of size 5 alloc'd
==28934==    at 0x4A1B95B: realloc (vg_replace_malloc.c:306)
==28934==    by 0xB7713C: xrealloc (xmalloc.c:179)
==28934==    by 0xB648DC: cpp_interpret_string (charset.c:1392)
==28934==    by 0xB64E90: cpp_interpret_string_notranslate (charset.c:1416)
==28934==    by 0xB5360A: do_linemarker (directives.c:956)
==28934==    by 0xB51F98: _cpp_handle_directive (directives.c:483)
==28934==    by 0xB624DE: _cpp_scan_out_logical_line (traditional.c:634)
==28934==    by 0xB62BF6: _cpp_read_logical_line_trad (traditional.c:305)
==28934==    by 0x41105F: gfc_cpp_preprocess (cpp.c:699)
==28934==    by 0x46FB35: gfc_new_file (scanner.c:1916)
==28934==    by 0x48720C: gfc_init (f95-lang.c:295)
==28934==    by 0x704A88: toplev_main (toplev.c:2045)


-- 
           Summary: preprocessing preprocessed output: invalid reads
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: dfranke at gcc dot gnu dot org
        ReportedBy: dfranke at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36379

Reply via email to