<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calling WriteConsoleOutputAttribute function triggers access violation in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582787#M171381</link>
    <description>&lt;P&gt;I do think you have a bug in your code, however. From what I'm reading, the routine expects to read nLength attributes, but your data structure has only one, so it will write random data to the other positions' attributes.&lt;/P&gt;&lt;P&gt;I did think of a workaround, which is to declare your own interface to WriteConsoleOutputAttribute that uses BIND(C) and VALUE instead of STDCALL - obviously this would be for x64 only. I have not tested this but I think it would work. But I still think it's better to keep using ifort for now.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Mar 2024 16:40:42 GMT</pubDate>
    <dc:creator>Steve_Lionel</dc:creator>
    <dc:date>2024-03-22T16:40:42Z</dc:date>
    <item>
      <title>Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582106#M171346</link>
      <description>&lt;P&gt;I try to recompile a project worked well under IFORT with the new IFX compiler. Calling the WriteConsoleOutputAttribute trigers an access violation. The function call is:&lt;/P&gt;&lt;P&gt;SCR_OutAtt = WriteConsoleOutputAttribute(SCR%OutputHandle, Loc(lpAttribute), nLength, dwWriteCoord, lpNumberOfCharsWritten)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the parameters:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Name Value Type&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;scr%OutputHandle&lt;/TD&gt;&lt;TD&gt;104&lt;/TD&gt;&lt;TD&gt;INTEGER(8)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;lpAttribute&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;INTEGER(8)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;nlength&lt;/TD&gt;&lt;TD&gt;47&lt;/TD&gt;&lt;TD&gt;INTEGER(4)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;◢&lt;/TD&gt;&lt;TD&gt;dwWriteCoord&lt;/TD&gt;&lt;TD&gt;{...}&lt;/TD&gt;&lt;TD&gt;TYPE(TKLIBMOD::T_COORD)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;dwWriteCoord%X&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;INTEGER(2)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;dwWriteCoord%Y&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;INTEGER(2)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;lpNumberOfCharsWritten&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;INTEGER(8)&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong? According to KERNEL32.f90 the parameter declarations are correct.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 13:27:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582106#M171346</guid>
      <dc:creator>TiborKibedi1</dc:creator>
      <dc:date>2024-03-20T13:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582192#M171351</link>
      <description>&lt;P&gt;Please attach a minimal but complete example source.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 18:51:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582192#M171351</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-03-20T18:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582434#M171362</link>
      <description>&lt;P&gt;Thanks Steve for looking into this. I made a fresh installation of VS, One-Api and the Intel Compiler, but the problem still persists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is the source and project files. It was compiled and linked using MS VS 2022 17.9.4, One-API and IFX 2024.0.&lt;/P&gt;&lt;P&gt;The access violation happens at line 450 in&amp;nbsp; TK_LibMod.f90.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 15:47:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582434#M171362</guid>
      <dc:creator>TiborKibedi1</dc:creator>
      <dc:date>2024-03-21T15:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582439#M171364</link>
      <description>&lt;P&gt;Well I think you mean this line:&lt;/P&gt;&lt;P&gt;SCR_OutAtt = WriteConsoleOutputAttribute(SCR%OutputHandle, Loc(lpAttribute), nLength, dwWriteCoord, lpNumberOfCharsWritten)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The last parameter &lt;SPAN&gt;_Out_&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LPDWORD lpNumberOfAttrsWritten&amp;nbsp;&lt;/SPAN&gt;is meant to be an integer pointer to a dword so if you have:&lt;/P&gt;&lt;P&gt;integer(dword) :: Numbeofchars&lt;/P&gt;&lt;P&gt;you need to pass loc(Numbeofchars) and the function will write to that address. Dword is 4 bytes but the address is 8 bytes whicg is probs where it violates.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 16:09:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582439#M171364</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2024-03-21T16:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582756#M171378</link>
      <description>&lt;P&gt;I am still having problems calling the&amp;nbsp;WriteConsoleOutputAttribute(SCR%OutputHandle, Loc(SCR%Attributes), nLength, dwWriteCoord, Loc(NumberOfChars)) function. I followed the interface declaration in the KERNEL32.f90 module:&lt;/P&gt;&lt;P&gt;INTERFACE&lt;BR /&gt;FUNCTION WriteConsoleOutputAttribute( &amp;amp;&lt;BR /&gt;hConsoleOutput, &amp;amp;&lt;BR /&gt;lpAttribute, &amp;amp;&lt;BR /&gt;nLength, &amp;amp;&lt;BR /&gt;dwWriteCoord, &amp;amp;&lt;BR /&gt;lpNumberOfAttrsWritten)&lt;BR /&gt;import&lt;BR /&gt;integer(BOOL) :: WriteConsoleOutputAttribute ! BOOL&lt;BR /&gt;!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WriteConsoleOutputAttribute' :: WriteConsoleOutputAttribute&lt;BR /&gt;integer(HANDLE) hConsoleOutput ! HANDLE hConsoleOutput&lt;BR /&gt;integer(LPWORD) lpAttribute ! WORD* lpAttribute&lt;BR /&gt;integer(DWORD) nLength ! DWORD nLength&lt;BR /&gt;TYPE (T_COORD) dwWriteCoord ! COORD dwWriteCoord&lt;BR /&gt;integer(LPDWORD) lpNumberOfAttrsWritten ! LPDWORD lpNumberOfAttrsWritten&lt;BR /&gt;END FUNCTION&lt;BR /&gt;END INTERFACE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The variables in my code are declared as&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Integer&lt;/SPAN&gt;(HANDLE) &amp;nbsp; &amp;nbsp; SCR%OutputHandle&lt;/P&gt;&lt;P&gt;Integer(LPWORD) &amp;nbsp;SCR%Attributes&lt;/P&gt;&lt;P&gt;Integer(DWORD) &amp;nbsp; &amp;nbsp;nLength&lt;/P&gt;&lt;P&gt;Type (T_COORD) &amp;nbsp; dwWriteCoord&lt;/P&gt;&lt;P&gt;Integer(LPDWORD) &amp;nbsp;NumberOfChars&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Declaring "NumberOfChars" as DWORD makes no difference. The same code, initially developed and worked under previous versions of Intel Fortran and the problem surface with the latest &amp;nbsp;version, when the IFX compiler is being used. Interestingly, switching to IFORT in the latest distribution, the code works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It may indicate a bug in the IFX compiler. Attached is a cut down version of the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Win11, VS 2022, Intel oneAPI 2024.0, Intel Fortran Compiler 2024.0&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 12:46:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582756#M171378</guid>
      <dc:creator>TiborKibedi1</dc:creator>
      <dc:date>2024-03-22T12:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582782#M171380</link>
      <description>&lt;P&gt;Indeed, ifx does have a bug, but it is subtle.&lt;/P&gt;&lt;P&gt;The problem relates to the fourth argument, which is a structure of type T_COORD passed by value. T_COORD has two components that are 16-bit integers, so a single value of type T_COORD is 32 bits. The Windows API expects to receive this by-value, with the 32 bits passed in register R9; ifort does this, However, ifx doesn't want to pass this by value and instead passes something else, which causes it to try to write to improper locations in the console buffer.&lt;/P&gt;&lt;P&gt;I wrote a small test program to demonstrate this, but first wanted to see if using BIND(C) and VALUE rather than ATTRIBUTES STDCALL showed the same bug - it did not.&lt;/P&gt;&lt;P&gt;Here's the minimal example (sources attached). Just to make sure there was no issue with inlining, I put the subroutine in a separate source. I also have some evidence that ifx improperly receives a 32-bit structure when STDCALL is in effect.&lt;/P&gt;&lt;P&gt;struct.f90&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;module ctypes
use, intrinsic :: ISO_FORTRAN_ENV
type COORD_T
  integer(INT16) :: X, Y
  end type COORD_T
end module ctypes
program struct_test
use ctypes
implicit none
type(COORD_T) :: COORD
interface
  subroutine sub (COORD)
  import
!DIR$ ATTRIBUTES STDCALL :: sub
  type(COORD_T), VALUE :: COORD
  end subroutine sub
end interface
COORD = COORD_T (314,159)

call sub (COORD)
end&lt;/LI-CODE&gt;&lt;P&gt;sub.f90&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;subroutine sub (A,B,C,COORD) BIND(C)
use ctypes
implicit none
integer, value :: A,B,C
type(COORD_T), value :: COORD
print '(2I6)', COORD
end subroutine sub&lt;/LI-CODE&gt;&lt;LI-CODE lang="none"&gt;D:\Projects&amp;gt;ifort /c /Qdiag-disable:10448 sub.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.11.1 Build 20231117_000000
Copyright (C) 1985-2023 Intel Corporation.  All rights reserved.


D:\Projects&amp;gt;ifort /Qdiag-disable:10448 struct.f90 sub.obj
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.11.1 Build 20231117_000000
Copyright (C) 1985-2023 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 14.39.33522.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:struct.exe
-subsystem:console
struct.obj
sub.obj

D:\Projects&amp;gt;struct.exe
   314   159

D:\Projects&amp;gt;ifx -c sub.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.


D:\Projects&amp;gt;ifx struct.f90 sub.obj
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.39.33522.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:struct.exe
-subsystem:console
struct.obj
sub.obj

D:\Projects&amp;gt;struct.exe
   314     0&lt;/LI-CODE&gt;&lt;P&gt;The only solution for now is to keep using ifort.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 15:58:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582782#M171380</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-03-22T15:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582787#M171381</link>
      <description>&lt;P&gt;I do think you have a bug in your code, however. From what I'm reading, the routine expects to read nLength attributes, but your data structure has only one, so it will write random data to the other positions' attributes.&lt;/P&gt;&lt;P&gt;I did think of a workaround, which is to declare your own interface to WriteConsoleOutputAttribute that uses BIND(C) and VALUE instead of STDCALL - obviously this would be for x64 only. I have not tested this but I think it would work. But I still think it's better to keep using ifort for now.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 16:40:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1582787#M171381</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-03-22T16:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583156#M171385</link>
      <description>&lt;P&gt;Steve,&lt;/P&gt;&lt;P&gt;Then would you/we assume that any user defined type that has sizeof of 1, 2, 4, 8 bytes (same sizeof as native types), passed by value to bind(C) procedure, would experience the problem with ifx (as of 3/25/24 or earlier release)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so, I can see a lot of code breaking. I am surprised this issue hasn't shown up much on this forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 15:04:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583156#M171385</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2024-03-25T15:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583219#M171388</link>
      <description>&lt;P&gt;There are some issues with the example shown above.&amp;nbsp; The interface for sub does not have BIND(C) specified and the arguments do not match the implementation (A,B,C??). If I also add BIND(C) to the type definition and remove A,B,C from sub it runs and&amp;nbsp; gives the correct answer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 17:50:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583219#M171388</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2024-03-25T17:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583257#M171389</link>
      <description>&lt;P&gt;The example was contrived to demonstrate the problem. Removing A, B and C hides the issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, anything up to 8 bytes should be passed by value when the STDCALL convention is in effect. I believe MSVC does this even for the C convention. I have not looked to see what convention is used on Linux. ifort does it right, ifx does not.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 20:02:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583257#M171389</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-03-25T20:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583595#M171401</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/5442"&gt;@Steve_Lionel&lt;/a&gt;,&amp;nbsp;I'm having trouble getting the same answers as you do with your reproducer using ifort.&lt;/P&gt;
&lt;LI-CODE lang="bash"&gt;Q:\tmp&amp;gt;ifort /Qdiag-disable:10448 -what struct.f90 sub.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.11.0 Build 20231010_000000
Copyright (C) 1985-2023 Intel Corporation.  All rights reserved.

 Intel(R) Fortran 2021.11.0-1242.01
 Intel(R) Fortran 2021.11.0-1242.01
Microsoft (R) Incremental Linker Version 14.38.33130.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:struct.exe
-subsystem:console
struct.obj
sub.obj

Q:\tmp&amp;gt;struct.exe
   256     0
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 16:52:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583595#M171401</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2024-03-26T16:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583597#M171402</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/44501"&gt;@Barbara_P_Intel&lt;/a&gt;&amp;nbsp;Don't compile them together - do it separately as I did. However, I find the result you did get to be wrong as well - I can't reproduce that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="none"&gt;D:\Projects&amp;gt;ifort /Qdiag-disable:10448 -what struct.f90 sub.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.11.1 Build 20231117_000000
Copyright (C) 1985-2023 Intel Corporation.  All rights reserved.

 Intel(R) Fortran 2021.11.1-1242.01
 Intel(R) Fortran 2021.11.1-1242.01
Microsoft (R) Incremental Linker Version 14.39.33522.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:struct.exe
-subsystem:console
struct.obj
sub.obj

D:\Projects&amp;gt;struct.exe
   314   159&lt;/LI-CODE&gt;&lt;LI-CODE lang="none"&gt;D:\Projects&amp;gt;ifx -c -what sub.f90
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

 Intel(R) Fortran 24.0-1238.2

D:\Projects&amp;gt;ifx -what struct.f90 sub.obj
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.2 Build 20231213
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

 Intel(R) Fortran 24.0-1238.2
Microsoft (R) Incremental Linker Version 14.39.33522.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:struct.exe
-subsystem:console
struct.obj
sub.obj

D:\Projects&amp;gt;struct.exe
   314     0&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 17:01:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583597#M171402</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-03-26T17:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583605#M171405</link>
      <description>&lt;P&gt;I just realized that I posted the wrong version of the source. The module ctypes should be in sub.f90, not struct.f90! Sorry for the confusion.&lt;/P&gt;&lt;P&gt;sub.f90&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;module ctypes
use, intrinsic :: ISO_FORTRAN_ENV
type COORD_T
  integer(INT16) :: X, Y
  end type COORD_T
end module ctypes
subroutine sub (A,B,C,COORD) BIND(C)
use ctypes
implicit none
integer, value :: A,B,C
type(COORD_T), value :: COORD
print '(2I6)', COORD
end subroutine sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;struct.f90&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;program struct_test
use ctypes
implicit none
type(COORD_T) :: COORD
interface
  subroutine sub (A,B,C,COORD)
  import
!DIR$ ATTRIBUTES STDCALL :: sub
  integer :: A,B,C
  type(COORD_T):: COORD
  end subroutine sub
end interface
COORD = COORD_T (314,159)

call sub (1,2,3,COORD)
end&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 26 Mar 2024 17:35:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583605#M171405</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2024-03-26T17:35:13Z</dc:date>
    </item>
    <item>
      <title>Re:Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583610#M171407</link>
      <description>&lt;P&gt;Thanks, &lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/5442"&gt;@Steve_Lionel&lt;/a&gt;, for the update to your reproducer. ifx outputs the same wrong answers for me now with the latest release, 2024.0.0.&lt;/P&gt;&lt;P&gt;The better news is that with a preview of 2024.1.0 ifx prints the same right answers as ifort.&lt;/P&gt;&lt;P&gt;Look for that release in the next week or so.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Mar 2024 17:49:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583610#M171407</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2024-03-26T17:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calling WriteConsoleOutputAttribute function triggers access violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583612#M171408</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/288622"&gt;@TiborKibedi1&lt;/a&gt;, with your scaled down reproducer, TkLib_Test.f90, I get an access violation like you do when compiling with ifx 2024.0.0.&lt;/P&gt;
&lt;P&gt;BUT there's good news! With ifx 2024.1.0, it runs successfully, assuming this is the output you expect:&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;Q:\06175490&amp;gt;TkLib_Test.exe
 * * * TkLibTest * * *&lt;/LI-CODE&gt;
&lt;P&gt;Look for this new compiler in the next week or so.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 18:03:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-WriteConsoleOutputAttribute-function-triggers-access/m-p/1583612#M171408</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2024-03-26T18:03:41Z</dc:date>
    </item>
  </channel>
</rss>

