This is an archive of the discontinued LLVM Phabricator instance.

[flang][docs] Update -fbackslash option for PGI compilers
AcceptedPublic

Authored by FruitClover on Apr 26 2022, 5:11 AM.

Details

Summary

PGI has reversed default option for escapes in literals compared to
flang/gfortan/Intel, note that and also that GNU has extension for "\"
interptetation:

$ cat f.f90
subroutine f()
  character, parameter :: x = "\"
end

gfortran:

$ gfortran f.f90 -fsyntax-only -std=f2018
$ gfortran f.f90 -fsyntax-only -std=f2018 -fbackslash
f.f90:2:33:

    2 |   character, parameter :: x = "\"
      |                                 1
Warning: Extension: backslash character at (1)

nvfortan:

$ nvfortran f.f90 -Msyntax-only
NVFORTRAN-S-0026-Unmatched quote (f.f90: 2)
  0 inform,   0 warnings,   1 severes, 0 fatal for f
$ nvfortran f.f90 -Msyntax-only -Mbackslash

flang:

$ flang-new f.f90 -fsyntax-only
$ flang-new f.f90 -fsyntax-only -fbackslash
error: Could not scan f.f90
./f.f90:2:31: error: Incomplete character literal
    character, parameter :: x = "\"
                                ^^^

Diff Detail

Event Timeline

FruitClover created this revision.Apr 26 2022, 5:11 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 26 2022, 5:11 AM
FruitClover published this revision for review.Apr 26 2022, 5:17 AM
FruitClover added a reviewer: PeteSteinfeld.
FruitClover added a subscriber: flang-commits.
FruitClover edited the summary of this revision. (Show Details)Apr 26 2022, 10:01 AM
FruitClover edited the summary of this revision. (Show Details)

Fix typo

PeteSteinfeld accepted this revision.May 4 2022, 7:09 PM

Sorry for the delay. I didn't notice this the first time around.

Thanks for doing this!

This revision is now accepted and ready to land.May 4 2022, 7:09 PM