- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a sample of code that have different outputs depending on the degree of optimisation.
Output :
$ ./compil_sh
$ ./a.out
fin_init_vitesse = 300000.000000000
LumC = 300000.000000000
$ ./compil_sh_bug
$ ./a.out
fin_init_vitesse = 300000.000000000
LumC = 2.00000000000000
Function LumC here points to the imaginary part of Const%CI if it was compiled with "-O0" or "-O1" (thus with "-g"), but gives the expected value with "-O2" or at least "-O1 -ip".
Furthermore, LumC points to the expected value without specifying "kind=8" for the complex CI.
It was tested on several computers, from ifort 9.023 to 9.1.032.
Seems like a bug of the compiler to me.
Sources :
- compile_sh
- compile_sh_bug
- prog_bidon.f90
- mod_bidon.f90
Output :
$ ./compil_sh
$ ./a.out
fin_init_vitesse = 300000.000000000
LumC = 300000.000000000
$ ./compil_sh_bug
$ ./a.out
fin_init_vitesse = 300000.000000000
LumC = 2.00000000000000
Function LumC here points to the imaginary part of Const%CI if it was compiled with "-O0" or "-O1" (thus with "-g"), but gives the expected value with "-O2" or at least "-O1 -ip".
Furthermore, LumC points to the expected value without specifying "kind=8" for the complex CI.
It was tested on several computers, from ifort 9.023 to 9.1.032.
Seems like a bug of the compiler to me.
Sources :
- compile_sh
#!/bin/bash
ifort -module ./ -c -O2 mod_bidon.f90
ifort -module ./ -c -O2 prog_bidon.f90
ifort -module -O2 mod_bidon.o prog_bidon.o
- compile_sh_bug
#!/bin/bash
ifort -module ./ -c -O1 mod_bidon.f90
ifort -module ./ -c -O1 prog_bidon.f90
ifort -module -O1 mod_bidon.o prog_bidon.o
- prog_bidon.f90
program bidon
use constantes
implicit none
real(kind=8) :: lum
call InitialiserConst()
lum = LumC()
print *, 'LumC = ', lum
end program bidon
- mod_bidon.f90
module constantes
implicit none
type t_constantes
real(kind=8) :: Pi
real(kind=8) :: Vitesse
complex(kind=8) :: Ci
end type t_constantes
type(t_constantes) :: Const
contains
subroutine InitialiserConst()
Const%Pi = 3.14
Const%Vitesse = 300000
Const%Ci = (0.0, 2.0)
print *, 'fin_init_vitesse = ', Const%Vitesse
end subroutine InitialiserConst
real(kind=8) function LumC()
LumC = Const%Vitesse
end function LumC
end module constantes
Message Edited by under7 on 05-16-200601:42 PM
Message Edited by under7 on 05-16-200601:42 PM
Message Edited by under7 on 05-16-200601:43 PM
Message Edited by under7 on 05-16-200601:47 PM
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree that it's a bug. Please submit it to Intel Premier Support.

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