Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29282 Discussions

Compiler bug with fpp in 2024.2.1(2021.12.0) version

netphilou31
New Contributor III
817 Views

Hi,

I found a strange behavior with the version 2024.2.1 (2021.12.0) version of the IFORT compiler. A Fortran module is getting some fpp errors, while there is no compilation directives in it! The module compiles fine with earlier versions. Based on the identified location of the so called errors, I discovered that the module uses array of integers initialized with hexadecimal values written as something like #AB16D4. The preprocessor says:

HashData.f90(393): #error: unknown fpp directive.

while the corresponding line is the line #2 below.

    integer(4) :: k(64) = [ #D76AA478, #E8C7B756, #242070DB, #C1BDCEEE, #F57C0FAF, #4787C62A, #A8304613, #FD469501, &
                            #698098D8, #8B44F7AF, #FFFF5BB1, #895CD7BE, #6B901122, #FD987193, #A679438E, #49B40821, &
                            #F61E2562, #C040B340, #265E5A51, #E9B6C7AA, #D62F105D, #02441453, #D8A1E681, #E7D3FBC8, &
                            #21E1CDE6, #C33707D6, #F4D50D87, #455A14ED, #A9E3E905, #FCEFA3F8, #676F02D9, #8D2A4C8A, &
                            #FFFA3942, #8771F681, #6D9D6122, #FDE5380C, #A4BEEA44, #4BDECFA9, #F6BB4B60, #BEBFBC70, &
                            #289B7EC6, #EAA127FA, #D4EF3085, #04881D05, #D9D4D039, #E6DB99E5, #1FA27CF8, #C4AC5665, &
                            #F4292244, #432AFF97, #AB9423A7, #FC93A039, #655B59C3, #8F0CCC92, #FFEFF47D, #85845DD1, &
                            #6FA87E4F, #FE2CE6E0, #A3014314, #4E0811A1, #F7537E82, #BD3AF235, #2AD7D2BB, #EB86D391 ]

I found that changing the way the hexadecimal constants are written, for example Z'698098D8' instead of #698098D8, solved the issue. The other strange thing is that Fortran modules generated using the Fortran module wizard contain a lot of hexadecimal constants written this way and thy compile fine.

Any idea? I can provide the source code if needed.

Best regards,

0 Kudos
11 Replies
netphilou31
New Contributor III
753 Views

Additional information.

The problem seems relating to the declaration of the array k() over several lines with continuation marks '&', because if all the declaration is made on a single line, no fpp error is issued.

 

Best regards,

0 Kudos
jimdempseyatthecove
Honored Contributor III
661 Views

Alternate hack to try:

    integer(4) :: k(64) = [ #D76AA478, #E8C7B756, #242070DB, #C1BDCEEE, #F57C0FAF, #4787C62A, #A8304613, #FD469501, &
                          & #698098D8, #8B44F7AF, #FFFF5BB1, #895CD7BE, #6B901122, #FD987193, #A679438E, #49B40821, &
...

(add & to front of each continuation line)

 

Jim Dempsey

0 Kudos
JohnNichols
Valued Contributor III
620 Views

Somewhere in Metcalf and Eddy I saw recently that the &..........................& is required for some objects, I think it included arrays.  

Could be wrong. 

0 Kudos
netphilou31
New Contributor III
437 Views

Hi John,

Can you give me more information about "Metcalf and Eddy" you are refering to?

Best regards,

0 Kudos
netphilou31
New Contributor III
458 Views

Hi Jim and John,

Thanks for the reply and advices. I never thought that using a pair of & was something authorized by the Fortran compiler.

Anyway this is clearly a bug since this type of declaration was working in previous versions. Anyway I browsed all my source code to change the declaration of hexadecimal constants with # by the standard form Z'**bleep**' which is, unfortunately, a bit less easy to read but works (I did not change the sources codes automatically generated by the Fortran Module Wizard since they comile fine).

Best regards,

0 Kudos
netphilou31
New Contributor III
440 Views

Not sure why my original text Z'.....' was replaced by  Z'**bleep**'

0 Kudos
andrew_4619
Honored Contributor III
303 Views

the main use & & is used when a string is split across lines.

Buf = 'How now brown &
       &cow'
0 Kudos
netphilou31
New Contributor III
279 Views

Hi Andrew,

I didn't know that there was a need to use a pair of & for a string split across lines.

Best regards,

0 Kudos
andrew_4619
Honored Contributor III
125 Views

There a need for the 2nd &  if you start the second line in column 1, but otherwise without it you get unwanted  spaces. 

0 Kudos
jimdempseyatthecove
Honored Contributor III
74 Views

FWIW fpp directives (are supposed to) start with # in column 1.

Therefore, if the continuation line started in column 1, you would have an error.

The sample you showed in post 1 did not show the continuation line starting in column1 so was your error elsewhere or is fpp accepting:

<NewLine><WhiteSpace>#...

as an fpp directive?

Jim Dempsey

0 Kudos
netphilou31
New Contributor III
24 Views

Hi Jim,

I don't know what happened with fpp, but what I'm sure is that there was no issue with all versions of oneAPI prior 2024.2 but maybe that's a new way of parsing fpp directives or simply a bug.

To be complete, the fpp phase was giving me additional errors (3) on other places without any continuation, so it was a bit confusing and hard to understand the real source of the problem.

I could have identified more easily the issue if fpp was clearly mentioning the #698098D8 declaration instead of saying … #error: unknown fpp directive!

Best regards,

0 Kudos
Reply