Automatic function result doesn't automatically result?

Automatic function result doesn't automatically result?

With ifort 12.0.5 and this program:

! ifort /check:all /warn:all /standard-semantics xxxx.f90 PROGRAM automatically_broken IMPLICIT NONE TYPE some_type INTEGER :: some_number END TYPE some_type TYPE(some_type) :: st_array(2) INTEGER :: fn_result(2) !**** st_array = [some_type(1), some_type(2)] fn_result = do_some_counting(st_array, 2) PRINT "('Out of the function the result is: ',99(I0,:,','))", fn_result CONTAINS FUNCTION do_some_counting(st_arg, idx) RESULT(res) TYPE(some_type), INTENT(IN) :: st_arg(:) INTEGER, INTENT(IN) :: idx INTEGER :: res(st_arg(idx)%some_number) !---- INTEGER :: i !**** res = [(i, i = 1, SIZE(res))] PRINT "('In the function st_arg(idx)%some_number is ',I0)", & st_arg(idx)%some_number PRINT "('In the function the result is: ',99(I0,:,','))", res END FUNCTION do_some_counting END PROGRAM automatically_broken 

I got:

In the function st_arg(idx)%some_number is 2 In the function the result is: 0,4635040 Out of the function the result is: 0,0
which made me address the compiler with rather strong language earlier today.

4 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Understandable. At first glance it seems that res isn't being set up properly. We'll take a closer look.

Steve - Intel Developer Support

Curious thing - in 12.0.5 this fails on IA-32 but works on Intel 64. In the upcoming 12.0.6 it works when optimization is disabled on IA-32 but not with optimization. Escalated as DPD200172823.

Steve - Intel Developer Support

This was fixed in the 13.0 (Composer XE 2013 initial release) compiler, but I didn't find out about that until today.

Steve - Intel Developer Support

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!