- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Running the following simple program gives strange output.
>ifort constructor.f90
Intel Visual Fortran Compiler Professional for applications running on IA-32, Version 11.1 Build 20091130 Package ID: w_cprof_p_11.1.054
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
-out:constructor.exe
-subsystem:console
constructor.obj
>constructor.exe
ABC 3
ABC 3
ABC 3
All the allocatable strings are the same length. When changing the order of constructors as follows:
>constructor.exe
ABCDEFGHIJ 10
ABCDEFG 10
ABC 10
What the ...? I naively assumed to get strings with different lengths.
Again, if the initialization of A, B and C is changed to:
>constructor.exe
ABC 3
ABCDEFG 7
ABCDEFGHIJ 10
Is this a feature or a bug?
BR,
-Heikki
Running the following simple program gives strange output.
[bash] MODULE TEST_MOD IMPLICIT NONE TYPE STRING CHARACTER(LEN=:), ALLOCATABLE :: S END TYPE END MODULE PROGRAM TEST USE TEST_MOD IMPLICIT NONE TYPE(STRING) :: A, B, C A = STRING('ABC') B = STRING('ABCDEFG') C = STRING('ABCDEFGHIJ') WRITE(*,*) A % S, LEN(A % S) WRITE(*,*) B % S, LEN(B % S) WRITE(*,*) C % S, LEN(C % S) END PROGRAM [/bash]Compiling and running the program gives the following output:
>ifort constructor.f90
Intel Visual Fortran Compiler Professional for applications running on IA-32, Version 11.1 Build 20091130 Package ID: w_cprof_p_11.1.054
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
-out:constructor.exe
-subsystem:console
constructor.obj
>constructor.exe
ABC 3
ABC 3
ABC 3
All the allocatable strings are the same length. When changing the order of constructors as follows:
[bash] A = STRING('ABCDEFGHIJ') B = STRING('ABCDEFG') C = STRING('ABC') [/bash]and recompiling and running the test program gives the following output:
>constructor.exe
ABCDEFGHIJ 10
ABCDEFG 10
ABC 10
What the ...? I naively assumed to get strings with different lengths.
Again, if the initialization of A, B and C is changed to:
[bash] A % S = 'ABC' B % S = 'ABCDEFG' C % S = 'ABCDEFGHIJ' [/bash]The output is what I expected to get in the first case:
>constructor.exe
ABC 3
ABCDEFG 7
ABCDEFGHIJ 10
Is this a feature or a bug?
BR,
-Heikki
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This error does not occur with the more recent releases 11.1.065 or 11.1.067.

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