4. Solaris Studio Fortran 的功能与差异
5. FORTRAN 77 兼容性:迁移到 Solaris Studio Fortran
B.1 Oracle Solaris Studio 12.2 Fortran 发行版
B.2 Sun Studio 12 Update 1 Fortran 发行版
Fortran 95 编译器中并入了 Fortran 77 功能
此发行版的 Forte Developer 软件用 f95 编译器中的新增功能替代了 f77 编译器。f77 命令是一个调用 f95 编译器的脚本:
the command: f77 options files libraries becomes a call to the f95 compiler:: f95 -f77=%all -ftrap=%none options files -lf77compat libraries
有关 Fortran 77 兼容性和不兼容性的详细信息,请参见4.12 混合语言。
Fortran 77 兼容性模式:
新的 -f77 标志选择各种不同的兼容性功能,使编译器能够接受很多通常与 Fortran 95 不兼容的 Fortran 77 结构和约定。请参见3.4.23 -f77[= list]和4.12 混合语言。
对使用非标准别名的“旧式”程序进行编译:
f95 编译器必须假定它所编译的程序符合 Fortran 95 有关通过子程序调用、全局变量、指针和过度索引来设置变量别名的标准。很多“旧式”传统程序特意使用别名技术解决早期版本的 Fortran 语言中存在的缺点。请使用新的 -xalias 标志,让编译器知道程序与标准偏离的程度,以及预计会出现哪种别名问题。在某些情况下,只有在指定了正确的 -xalias 子选项时,编译器才会生成正确的代码。严格遵循标准的程序可以建议编译器不必考虑别名问题,从而可使性能得到一定的提高。请参见3.4.108 -xalias[= keywords]以及《Fortran 编程指南》中有关移植的章节。
增强的 MODULE 功能:
新标志 -use=list 可强制将一个或多个隐式 USE 语句添加到每个子程序中。请参见3.4.100 -use= list。
新标志 -moddir=path 可控制编译器在哪里写入已编译的 MODULE 子程序(.mod 文件)。请参见3.4.55 -moddir= path。新环境变量 MODDIR 也可以控制写入 .mod 文件的位置。
-Mpath 标志现在可以接受在目录路径、归档 (.a) 文件或模块 (.mod) 文件中搜索 MODULE 子程序。编译器通过检查其内容来确定文件的类型;实际的文件扩展名会被忽略。请参见3.4.53 -Mpath。
现在,编译器在搜索模块时,先在写入模块文件的目录中查找。
有关详细信息,请参见4.9 模块文件。
使用 -Xlist 执行增强的全局程序分析:
此发行版的 f95 编译器在由 -Xlist 标志提供的全局程序分析中添加了许多新检查。新的 -XlistMP 子选项在静态程序分析方面开创了一个新的领域:OpenMP 并行化指令验证。有关详细信息,请参见3.4.106 -Xlist[ x]、Forte Developer 的《OpenMP API 用户指南》以及《Fortran 编程指南》中有关程序分析和调试的章节。
使用 -xknown_lib=library 标识已知库:
新选项 -xknown_lib=library 指示编译器将对某些已知库的引用作为内部函数处理,并忽略用户提供的任何版本。这样,编译器就可以基于其对库的特殊了解来对库调用进行优化。在此发行版中,已知库的名称仅限于 blas 和 intrinsics,前者代表 Sun 性能库中 BLAS 例程的一个子集,后者则用于忽略 Fortran 95 标准内部函数以及由用户提供的任何上述例程版本的显式 EXTERNAL 声明。请参见3.4.136 -xknown_lib=library_list。
忽略接口中的哑元参数类型:
新增指令 !$PRAGMA IGNORE_TKR { list_of_variables} 使编译器在解析特定调用时,忽略在通用过程接口中出现的指定哑元参数名称的类型、种类和等级。对于基于参数类型、种类或等级调用特定库例程的包装器来说,使用此指令可大大简化为其编写通用接口的工作。有关详细信息,请参见2.3.1.2 IGNORE_TKR 指令。
增强的 -C 运行时数组检查:
在此发行版的 f95 编译器中,使用 -C 选项进行的运行时数组下标范围检查得到了增强,可以包括数组一致性检查。如果在数组段不一致的地方执行数组语法语句,就会导致运行时错误。请参见3.4.6 -C。
引入 Fortran 2003 功能:
在此发行版的 f95 中,实现了某些为下一个 Fortran 标准而建议的新的格式化 I/O 功能。这些功能包括 DECIMAL=、ROUND= 和 IOMSG= 说明符,它们可以出现在 OPEN、READ、WRITE、PRINT 和 INQUIRE 语句中。另外,还实现了 DP、DC、RP 和 RC 编辑描述符。有关详细信息,请参见4.6.9 Fortran 2003 格式化 I/O 功能。
格式化 I/O 中的舍入:
新增的选项标志 -iorounding 可以为格式化 I/O 设置缺省舍入模式。该模式(processor-defined 或 compatible),对应于作为 Fortran 2003 功能的一部分而实现的 ROUND= 说明符。请参见3.4.45 -iorounding[={ compatible|processor-defined}]。
删除的过时标志:
下列标志已从 f95 命令行中删除:
-db -dbl
f95 编译器中没有实现下列 f77 编译器标志,因此这些标志也被视为过时:
-arg=local -i2 -i4 -misalign -oldldo -r8 -vax-xl -xvpara -xtypemap=integer:mixed
栈溢出检查:
在使用新的 -xcheck=stkovf 标志进行编译时,将在子程序入口处添加对栈溢出条件的运行时检查。如果检测到栈溢出,就会出现 SIGSEGV 段故障。对于在栈中分配了较大数组的多线程应用程序,其中的栈溢出可能导致相邻线程栈中出现隐性数据破坏。如果怀疑存在栈溢出,请使用 -xcheck=stkovf 编译所有例程。请参见3.4.115 -xcheck=keyword。
新的缺省线程栈大小:
在此版本中,SPARC V8 平台上的缺省从属线程栈大小已增加到 4 MB;而 SPARC V9 平台则增加到 8 MB。有关详细信息,请参见《Fortran 编程指南》的“并行化”一章中有关栈和栈大小的讨论。
增强的过程间优化:
编译器可使用 -xipo=1 跨所有源文件执行内联操作。此发行版增加了 -xipo=2,可实现增强的过程间别名分析、内存分配和布局优化,从而提高高速缓存性能。请参见3.4.131 -xipo[={ 0|1|2}]。
使用 -xprefetch_level=n 控制预取指令:
使用新标志 -xprefetch_level=n 可控制通过 -xprefetch=auto 进行的预取指令自动插入。使用时,要求 -xO3 或更高的优化级别以及支持预取的目标平台(-xarch 平台 v8plus、v8plusa、v8plusb、v9、v9a、v9b、generic64 或 native64)。请参见3.4.163 -xprefetch_level={ 1|2|3}。
您可以在 http://docs.sun.com Web 站点上的早期版本文档集中找到 Forte Developer 7 之前各版本的功能历史记录。