https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93193

            Bug ID: 93193
           Summary: C preprocessor works across commented lines
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i.s.ger at yandex dot ru
  Target Milestone: ---

C preprocessor works across commented lines, so than if C-like multiline
comments are in .F files, the output file in incorrect.


I have tried to compile the following file (gfortran 9.2.1):

program main
! /*
    print *, "Hello, World!"
! */
end program main

If -cpp flag is set, the output of `gfortran example.F90 -cpp -E` (compiled
program is incorrect):

# 1 "example.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "example.F90"
program main
! 


end program main

If -nocpp flag is set, the output of `gfortran example.F90 -nocpp -E` (compiled
program is correct):
 MAIN__ main
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <build_ssa_passes> <opt_local_passes>
<remove_symbols> <targetclone> <free-fnsummary>Streaming LTO
 <whole-program> <fnsummary> <inline> <free-fnsummary> <single-use>
<comdats>Assembling functions:
 <materialize-all-clones> <simdclone> MAIN__ main
Time variable                                   usr           sys          wall
              GGC
 phase parsing                      :   0.00 (  0%)   0.00 (  0%)   0.01 ( 50%)
   1684 kB ( 85%)
 phase opt and generate             :   0.01 (100%)   0.00 (  0%)   0.01 ( 50%)
    111 kB (  6%)
 parser (global)                    :   0.00 (  0%)   0.00 (  0%)   0.00 (  0%)
   1684 kB ( 85%)
 varconst                           :   0.00 (  0%)   0.00 (  0%)   0.01 ( 50%)
      0 kB (  0%)
 initialize rtl                     :   0.01 (100%)   0.00 (  0%)   0.00 (  0%)
     12 kB (  1%)
 rest of compilation                :   0.00 (  0%)   0.00 (  0%)   0.01 ( 50%)
      4 kB (  0%)
 TOTAL                              :   0.01          0.00          0.02       
   1978 kB

I do not know what the compiler wants to say to me in the second case, but I
would have expected to see preprocessored code.

Reply via email to