小编Jou*_*old的帖子

ifort中linux框上的编译器选项

我正在使用ifort并在尝试使用编译器选项编译程序时收到链接错误.不过,我已经在一个非常小的简单程序上测试了这些选项,我遇到了同样的问题.

因此我怀疑它与ifort的安装方式或我使用的系统类型有关但我不能确定.这些程序在没有选项的情况下编译时可以正常编译.我的问题是我做错了是否有一种方法在使用编译器选项或编译器选项与我正在使用的系统不兼容时不会出现这些错误.

这是程序如何定期编译:

 ifort -free  testrealprint.out testrealprint.f90
Run Code Online (Sandbox Code Playgroud)

以下是使用选项编译程序的方法:

    ifort -free  -O2 -stand f03 -check all -traceback -warn all -fstack-protector -    assume protect_parens -implicitnone testrealprint.out testrealprint.f90
Run Code Online (Sandbox Code Playgroud)

这是我用来测试编译器选项的非常简单的代码:

program main 

implicit none

real, dimension(1:3)  :: adremvect
 integer :: j
 character (LEN = 7) :: adremchar, adremcharadj,adremcharadjtrm, adremcharnew 
 adremvect = (/ 2.0, 1.3, 1.0 /)
  do j = 1, 3
        write(adremchar, '(f5.1)') adremvect(j)
        adremcharadj = adjustl(adremchar)
        adremcharadjtrm =  trim(adremcharadj)
         adremcharnew = adremchar(4:)
          print *, adremvect(j), adremcharadj, adremcharadjtrm, adremcharnew
 end do
Run Code Online (Sandbox Code Playgroud)

这是我使用编译器选项时收到的错误消息的一部分:

testrealprint.out: In …
Run Code Online (Sandbox Code Playgroud)

linker fortran compiler-errors

0
推荐指数
1
解决办法
1327
查看次数

FORTRAN中的释放和内存分配问题

我遇到了deallocate的问题并分配了部分FORTRAN代码的各个方面.特别是,我认为这个问题与通过搜索我在网络上的错误消息的内存分配有关.错误消息谈论无效指针,但是,我没有在我的程序中使用任何指针

在完成我的f循环的迭代#2(见下文)之后,程序崩溃了,或者大部分时间它崩溃了,有时它只是冻结了.我相信这就是bug的关键所在.因为程序运行到了这一点.

我没有显示子程序,但由于它们适用于其他模拟组合,我有理由相信它们不是问题.我正在使用deallocate并在程序中的其他地方分配(成功)所以我很惊讶它在这里不起作用.

我只是为了便于阅读而展示了该计划的一部分.特别是,我已经删除了对我编写的子程序的调用.我希望我已经为你的程序员提供了足够的信息来帮我解决问题.如果没有,请说明您想要的其他信息,我将很乐意遵守.我已经使用各种编译器选项编译了程序,并修复了一些错误并删除了任何警告.但是,此时,编译器选项不再向我提供任何信息.

allocate(poffvect(1:6))
allocate(phi1out(1:1))
allocate(phi2out(1:1))
allocate(phi1outs1(1:1))
allocate(phi2outs1(1:1))

     dummy allocation
   allocate(phi1outind(1:1))
   allocate(phi2outind(1:1))
   allocate(phi1outinds1(1:1))
   allocate(phi2outinds1(1:1))

   do e = 1, 6
     print *,"e", e
     do f = 1, 3

       print *,"f", f, iteratst1(f), trim(filenumcharimp)

       deallocate(phi1outinds1, STAT = AllocateStatus)
     if (AllocateStatus /= 0) stop "Error during  deallocation of phi1outinds1"
     print *, "Allocatestatus of phi1outinds1 is",  AllocateStatus
     deallocate(phi2outinds1, STAT = AllocateStatus)
    print *, "DeAllocatestatus of phi1outinds2 is", AllocateStatus

     if (AllocateStatus /= 0) stop "Error during deallocation of phi2outinds1"
    print *, "we deallocate f …
Run Code Online (Sandbox Code Playgroud)

fortran memory-management glibc double-free

-5
推荐指数
1
解决办法
1万
查看次数