- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
The following code generates a stack overflow on Windows (for a standard 1MB stack) even when compiled with default "Release" settings.
module test
contains
subroutine add_lines()
character(500):: line
integer:: loop_file
character(500),dimension(:),allocatable:: c
allocate(c(0))
c = ''
do loop_file=1,10000
line = 'abcd'
c = [character(len=500) :: c , line]
end do
end subroutine
end module test
program Console1
use test
implicit none
call add_lines()
end program Console1
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
This example is curious. I also see the stack exhaustion. I can prevent it by adding -heap-arrays. But it still should not need this option.
I need to investigate this more. it's not obvious to me why the constructor would blow up stack. It should only use 500 chars of storage. Might be that the RHS constructor is not being freed up after the copy to the LHS. Just a suspicion.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Yes, I also just found out that -heap-arrays (even with sizes far greater than the stack size) prevents it.
But without -heap-arrays:
While debugging through the loop, the stack-pointer is growing all the time. After leaving "add_lines" the stack-pointer has the correct value again (when the loop-counter is below the stack-overflow limit, of course).
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
BugID is CMPLRLLVM-69147

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora