- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I get an error message when trying to compile the following code snippet:
As far as I know there should not be an error. The code snippet comes from some automatic reformatting that happens as a result of source transformation.
[plain] program p X = 0.0D00 Y = 1.0D00 WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P'//'W) Wa +s", t55,2es12.5)') X,Y end program [/plain]The error message I am getting is:
[plain]formatString.f(5): error #5120: Unterminated character constant +s", t55,2es12.5)') X,Y -------^ formatString.f(5): error #5144: Invalid character_kind_parameter. No underscore +s", t55,2es12.5)') X,Y ----------------------------------------------^ formatString.f(4): error #5082: Syntax error, found ''' when expecting one of: (... WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P'//'W) Wa ------------------------------------------------------------------^ formatString.f(5): error #5082: Syntax error, found CHARACTER_CONSTANT ', t55,2es12.5)') X,Y' when expecting one of: ( * ) :: , ; + . - % (/ [ : ] /) . ** / // ... +s", t55,2es12.5)') X,Y -------^ compilation aborted for formatString.f (code 1) [/plain]
As far as I know there should not be an error. The code snippet comes from some automatic reformatting that happens as a result of source transformation.
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Evidently, you lost the formatting when you posted, so I turned it back to fixed form source.
You have incorrectly nested character strings. If I double the interior ' marks:
WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P''//''W)
+Was", t55,2es12.5)') X,Y
this appears to fix it.
You have incorrectly nested character strings. If I double the interior ' marks:
WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P''//''W)
+Was", t55,2es12.5)') X,Y
this appears to fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
Evidently, you lost the formatting when you posted, so I turned it back to fixed form source.
You have incorrectly nested character strings. If I double the interior ' marks:
WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P''//''W)
+Was", t55,2es12.5)') X,Y
this appears to fix it.
You have incorrectly nested character strings. If I double the interior ' marks:
WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P''//''W)
+Was", t55,2es12.5)') X,Y
this appears to fix it.
1: '(1x,"***OuterConvergenceofThermalFlux(MG/P'
2: 'W)Was",t55,2es12.5)'
(in the second I removed the newline+ continuation)
Both strings delimited by apostrophe characters and concatenaded by the // operator. The fact that each of them also happens to contain a double quote character looks confusing but - as far as I understand the standard - is ok. So, in other words, changing the single quotes to double quotes around the // like tim18 did would in effect remove the // operator and instead make it part of the string. Instead of the correct output which is:
***Outer Convergence of Thermal Flux (MG/PW) Was 0.00000E+00 1.00000E+00
the suggested change produces:
[cpp] ***Outer Convergence of Thermal Flux (MG/P W) Was 0.00000E+00 1.00000E+00 [/cpp]which clearly is wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
Evidently, you lost the formatting when you posted, so I turned it back to fixed form source.
You have incorrectly nested character strings. If I double the interior ' marks:
WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P''//''W)
+Was", t55,2es12.5)') X,Y
this appears to fix it.
You have incorrectly nested character strings. If I double the interior ' marks:
WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P''//''W)
+Was", t55,2es12.5)') X,Y
this appears to fix it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is fixed-form source but you have named it with a .f90 file type. Change the file type to .f or .for. However, even with that the compiler seems to have a problem with this code. It is legal, as far as I can tell. I suggest rewriting it as follows:
I will report this to the developers. The support ID is DPD200140398.
WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P'//
+'W)Was", t55,2es12.5)') X,Y
I will report this to the developers. The support ID is DPD200140398.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
This is fixed-form source but you have named it with a .f90 file type. Change the file type to .f or .for. However, even with that the compiler seems to have a problem with this code. It is legal, as far as I can tell. I suggest rewriting it as follows:
I will report this to the developers. The support ID is DPD200140398.
WRITE(*,'(1x," ***Outer Convergence of Thermal Flux (MG/P'//
+'W)Was", t55,2es12.5)') X,Y
I will report this to the developers. The support ID is DPD200140398.
It seems like a contrived problem when one looks at the example but I mentioned in my post that the code is the output of a source transformation process
in which things like this format string concatenation are parsed as string1-operator-string2
etc. and then eventually the AST is unparsed and reformatted to free or fixed format for a specified line length which leads to this strange looking but apparently syntactically correct code.
IOW, manually fixing the transformation output is not a feasible option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I understand that modifying the code is difficult for you - I was just explaining how to fix it if you could. We'll fix this as soon as we can.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been fixed in our sources - the fix should appear in Update 6 (April).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue is fixed in Update 6, available now.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page