GCC 4.5 リリース

GCC 4.5 がリリースされました。
リリースノートの日本語訳です。

Caveats
注意

  • GCC now requires the MPC library in order to build. See the prerequisites page for version requirements.
    GCCのビルドにはMPCが(訳注:従来のGMP,MPFRに加えて)必要です。必要なバージョンはprereqのページを参照してください。
  • Support for a number of older systems and recently unmaintained or untested target ports of GCC has been declared obsolete in GCC 4.5. Unless there is activity to revive them, the next release of GCC will have their sources permanently removed.
    いくつかのメンテナンスやテストが最近行われていない古いシステム向けのポーティングがGCC 4.5から廃止となっています。再び動きが活発にならない限りは、これらのソースは次のリリースより削除されます。
  • The following ports for individual systems on particular architectures have been obsoleted:
    次のシステム・アーキテクチャの組み合わせが廃止されました。
    • IRIX releases before 6.5 (mips-sgi-irix5*, mips-sgi-irix6.[0-4])
    • Solaris 7 (*-*-solaris2.7)
    • Tru64 UNIX releases before V5.1 (alpha*-dec-osf4*, alpha-dec-osf5.0*)
  • Details for the IRIX, Solaris 7, and Tru64 UNIX obsoletions can be found in the announcement.
    IRIX、Solaris 7、Tru64 UNIX廃止の詳細については別途アナウンスを参照してください。
  • Support has been removed for all the configurations obsoleted in GCC 4.4.
    GCC 4.4で廃止されたすべてのターゲットは削除されました。
  • Support has been removed for the protoize and unprotoize utilities, obsoleted in GCC 4.4.
    GCC 4.4で廃止されたprotoize/unprotoizeサポートは削除されました。
  • Support has been removed for tuning for Itanium1 (Merced) variants. Note that code tuned for Itanium2 should also run correctly on Itanium1.
    Intanium1 (Merced)向けのチューニングオプションは削除されました。Itanium2用にコンパイルしたすべてのコードはItanium1でも動作します。
  • GCC now generates unwind info also for epilogues. DWARF debuginfo generated by GCC now uses more features of DWARF3 than it used to do and also some DWARF4 features. GDB older than 7.0 is not able to handle either of these, so to debug GCC 4.5 generated binaries or libraries GDB 7.0 or later is needed. You can disable use of DWARF4 features with -gdwarf-3 -gstrict-dwarf options, or with -gdwarf-2 -gstrict-dwarf restrict GCC to just DWARF2 standard, but epilogue unwind info is emitted unconditionally whenever unwind info is emitted.
    GCCはunwind infoをエピローグ部にも生成するようになりました。デバッグ情報は、DWARF3に加えてDWARF4の一部の機能を使用できます。7.0より前のGDBではこれを扱えないので、GCC 4.5でコンパイルしたコードのデバッグは7.0以降のGDBが必要です。DWARF4の機能を無効にするには、-gdrawf-3 -gstrict-dwarfを、DWARF2のみを使用するには-gdwarf-2 -gstrict-dwarfを使用しますが、エピローグ部のunwind infoを無効にすることは出来ません。
  • On x86 targets, code containing floating-point calculations may run significantly slower when compiled with GCC 4.5 in strict C99 conformance mode than they did with earlier GCC versions. This is due to stricter standard conformance of the compiler and can be avoided by using the option -fexcess-precision=fast; also see below.
    x86ターゲットにおいて、浮動小数点演算を含んだコードをGCC 4.5でC99規格に厳密に準拠してコンパイルすると、以前のGCCに比べて明らかに遅くなることがあります。これは規格合致を改善したためで、以前の挙動に戻すには-fexcess-precision=fast(下記参照)を使用してください。
  • The function attribute noinline no longer prevents GCC from cloning the function. A new attribute noclone has been introduced for this purpose. Cloning a function means that it is duplicated and the new copy is specialized for certain contexts (for example when a parameter is a known constant).
    noinline属性はもはやGCCが関数の実体をコピーすることを妨げません。この挙動を再現するには新しい属性、noclone属性を使用してください。関数の実体のコピーが行われると、複製された関数はその文脈専用に最適化することが出来ます(たとえば、パラメータが定数の時に特殊な最適化が出来る場合があります)。

General Optimizer Improvements
全体のオプティマイザの強化

  • The -save-temps now takes an optional argument. The -save-temps and -save-temps=cwd switches write the temporary files in the current working directory based on the original source file. The -save-temps=obj switch will write files into the directory specified with the -o option, and the intermediate filenames are based on the output file. This will allow the user to get the compiler intermediate files when doing parallel builds without two builds of the same filename located in different directories from interfering with each other.
    -save-tempsは追加の引数を取るようになりました。-save-tempsと-save-temps=cwdは作業ディレクトリにソースファイルの拡張子を変更した名前で一時ファイルを書き出します。-save-temps=objは-oで与えられた出力ファイルの名前を変更して、そのディレクトリに書き出します。これにより、同じファイルを違うディレクトリに移さなくても並列ビルド時に中間ファイルを保存させることが出来るようになります。
  • Debugging dumps are now created in the same directory as the object file rather than in the current working directory. This allows the user to get debugging dumps when doing parallel builds without two builds of the same filename interfering with each other.
    デバッグダンプは作業ディレクトリではなく、オブジェクトファイルのあるディレクトリに出力されるようになりました。これにより並列ビルド時に同じ名前のファイルのデバッグダンプが干渉することがなくなります。
  • GCC has been integrated with the MPC library. This allows GCC to evaluate complex arithmetic at compile time more accurately. It also allows GCC to evaluate calls to complex built-in math functions having constant arguments and replace them at compile time with their mathematically equivalent results. In doing so, GCC can generate correct results regardless of the math library implementation or floating point precision of the host platform. This also allows GCC to generate identical results regardless of whether one compiles in native or cross-compile configurations to a particular target. The following built-in functions take advantage of this new capability: cacos, cacosh, casin, casinh, catan, catanh, ccos, ccosh, cexp, clog, cpow, csin, csinh, csqrt, ctan, and ctanh. The float and long double variants of these functions (e.g. csinf and csinl) are also handled.
    GCCはMPCと統合されました。これによりコンパイル時に複素数計算をより正確に行えるようになりました。また、複素数演算のビルトイン数学関数をコンパイル時定数に置き換えることができるようになっています。MPCの使用により、GCCはホストシステムの数学関数の実装に関わらず、セルフコンパイルおよびクロスコンパイルにおいて正確な結果を出力します。次に挙げる関数がこの影響を受けています: cacos, cacosh, casin, casinh, catan, catanh, ccos, cexp, clog, cpow, csin, csinh, csqrt, ctan, ctanhと、これらのfloatおよびlond double版。
  • A new link-time optimizer has been added (-flto). When this option is used, GCC generates a bytecode representation of each input file and writes it to special ELF sections in each object file. When the object files are linked together, all the function bodies are read from these ELF sections and instantiated as if they had been part of the same translation unit. This enables interprocedural optimizations to work across different files (and even different languages), potentially improving the performance of the generated code. To use the link-timer optimizer, -flto needs to be specified at compile time and during the final link. If the program does not require any symbols to be exported, it is possible to combine -flto and the experimental -fwhopr with -fwhole-program to allow the interprocedural optimizers to use more aggressive assumptions.
    新しくリンク時最適化が追加されました(-flto)(訳注:これはVC++でリンク時コード生成と呼ばれているものです)。このオプションが使われると、GCCバイトコードをオブジェクトファイルのELF特殊セクションに書き出します。このオブジェクトがリンクされると、すべての関数本体が特殊セクションから読み出され、同じ翻訳単位であったかのようにコード生成を行います。これにより関数間最適化が異なるファイル間において(異なる言語間でも)可能になり、コードの質を向上させます。リンク時最適化を行うには、-fltoがコンパイル時とリンク時の両方で必要になります。もしすべてのシンボルをexportする必要がない場合は、-fltoに加えて実験用に-fwhoprと-fwhole-programを使うことでオプティマイザに積極的にいくつかの仮定をさせることが出来ます。
  • The automatic parallelization pass was enhanced to support parallelization of outer loops.
    自動並列化機構が外側のループを並列化できるようになりました。
  • Automatic parallelization can be enabled as part of Graphite. In addition to -ftree-parallelize-loops=, specify -floop-parallelize-all to enable the Graphite-based optimization.
    自動並列化機構がGraphite(訳注:内部最適化パスの一つ)の一部として使えるようになりました。これを個別に有効にするには-ftree-parallelize-loops=を、すべてのGraphiteベースの並列化を有効にするには-floop-parallelize-allを使用してください。
  • The infrastructure for optimizing based on restrict qualified pointers has been rewritten and should result in code generation improvements. Optimizations based on restrict qualified pointers are now also available when using -fno-strict-aliasing.
    restrictポインタの最適化機構が書き直され、性能が向上しました。restrictによる最適化を有効にするには-fno-strict-aliasingを使用してください。
  • There is a new optimization pass that attempts to change prototype of functions to avoid unused parameters, pass only relevant parts of structures and turn arguments passed by reference to arguments passed by value when possible. It is enabled by -O2 and above as well as -Os and can be manually invoked using the new command-line switch -fipa-sra.
    関数のプロトタイプを必要に応じて変更する最適化パスが新設されました。このパスでは使われていないパラメータの削除、構造体パラメータの必要なフィールドだけを渡すように変更、参照パラメータを(可能ならば)値渡しに変更を行います。これは-O2または-Osにより自動的に行われます。手動で行うには-fipa-sraを使用します。
  • GCC now optimize exception handling code. In particular cleanup regions that are proved to not have any effect are optimized out.
    GCCは例外ハンドラの最適化を行うようになりました。何もしないと判断されたcleanupブロックは削除されます。

New Languages and Language specific improvements
新しい言語と言語固有の新機能

All languages
  • The -fshow-column option is now on by default. This means error messages now have a column associated with them.
    -fshow-columnがデフォルトで有効になりました。エラーメッセージは行番号だけではなく、文字位置まで報告します。
Ada(訳注:Adaはスルーさせてください)
  • Compilation of programs heavily using discriminated record types with variant parts has been sped up and generates more compact code.
  • Stack checking now works reasonably well on most plaforms. In some specific cases, stack overflows may still fail to be detected, but a compile-time warning will be issued for these cases.
C family
  • If a header named in a #include directive is not found, the compiler exits immediately. This avoids a cascade of errors arising from declarations expected to be found in that header being missing.
    #includeで指定されたヘッダが見つからなかったときはすぐにコンパイルを中止します。ヘッダがないことによる無駄に長くわかりにくいエラーの連鎖が発生しないようになりました。
  • A new built-in function __builtin_unreachable() has been added that tells the compiler that control will never reach that point. It may be used after asm statements that terminate by transferring control elsewhere, and in other places that are known to be unreachable.
    新しいビルトイン関数__builtin_unreachable()が追加され、コンパイラに到達不可能を明示できるようになりました。これはたとえばインラインアセンブリで制御を他に飛ばす命令を埋め込んだ際に後続の文が到達不可能であることを明示するときなどに使えます。
  • The -Wlogical-op option now warns for logical expressions such as (c == 1 && c == 2) and (c != 1 || c != 2), which are likely to be mistakes. This option is disabled by default.
    -Wlogical-opにより(c == 1 && c ==2)や(c != 1 || c != 2)のような(記述ミスに見える)意味のない表記を警告するようになりました。この警告はデフォルトでは無効になっています。
  • An asm goto feature has been added to allow asm statements that jump to C labels.
    asm goto(インラインアセンブリからCのラベルにジャンプする機能)が追加されました。
  • C++0x raw strings are supported for C++ and for C with -std=gnu99.
    C++0xのraw stringsがC++とC(-std=gnu99付き)で使えるようになりました。
  • The deprecated attribute now takes an optional string argument, for example, __attribute__((deprecated("text string"))), that will be printed together with the deprecation warning.
    deprecated属性が__attribute__((deprecated("text string")))のように文字列引数を取れるようになり、非推奨警告とともにメッセージを表示できるようになりました。
C
  • The -Wenum-compare option, which warns when comparing values of different enum types, now works for C. It formerly only worked for C++. This warning is enabled by -Wall. It may be avoided by using a type cast.
    -Wenum-compareオプションによる異なるenum同士の比較の警告がCでも有効になりました(以前はC++のみ有効でした)。この警告は-Wallで有効になります。キャストを行うことによりこの警告を抑制することが出来ます。
  • The -Wcast-qual option now warns about casts which are unsafe in that they permit const-correctness to be violated without further warnings. Specifically, it warns about cases where a qualifier is added when all the lower types are not const. For example, it warns about a cast from char ** to const char **.
    -Wcast-qualがconst透過性を破壊する可能性がある部分をさらに多く警告するようになりました。特に、すべての下位の構成型がconstでない時に修飾子が追加される、たとえば、char **からconst char **への(訳注:明示的でも)キャストをすると警告を発生します。
  • The -Wc++-compat option is significantly improved. It issues new warnings for:
    -Wc++-compatが発する警告が追加されました。
    • Using C++ reserved operator names as identifiers.
    • Conversions to enum types without explicit casts.
    • Using va_arg with an enum type.
    • Using different enum types in the two branches of ?:.
    • Using ++ or -- on a variable of enum type.
    • Using the same name as both a struct, union or enum tag and a typedef, unless the typedef refers to the tagged type itself.
    • Using a struct, union, or enum which is defined within another struct or union.
    • A struct field defined using a typedef if there is a field in the struct, or an enclosing struct, whose name is the typedef name.
    • Duplicate definitions at file scope.
    • Uninitialized const variables.
    • A global variable with an anonymous struct, union, or enum type.
    • Using a string constant to initialize a char array whose size is the length of the string.
  • The new -Wjump-misses-init option warns about cases where a goto or switch skips the initialization of a variable. This sort of branch is an error in C++ but not in C. This warning is enabled by -Wc++-compat.
    新しい-Wjump-misses-initによりgotoまたはswitchで変数の初期化がスキップされると警告されるようになりました。これはC++ではエラーですがCでは合法です。この警告は-Wc++-compatで有効になります。
  • GCC now ensures that a C99-conforming <stdint.h> is present on most targets, and uses information about the types in this header to implement the Fortran bindings to those types. GCC does not ensure the presence of such a header, and does not implement the Fortran bindings, on the following targets: NetBSD, VxWorks, VMS, SymbianOS, WinCE, LynxOS, Netware, QNX, Interix, TPF.
    GCCはC99準拠の<stdint.h>をほとんどすべてのターゲットで提供し、Fortranバインディングを提供しています。GCCはこのヘッダ(訳注:ヘッダ自体?準拠性?)とFortranバインディングNetBSD, VxWorks, VMS, SYmbianOS, WinCE, LynxOS, Netware, QNX, Interix, TPFでは提供しません。
  • GCC now implements C90- and C99-conforming rules for constant expressions. This may cause warnings or errors for some code using expressions that can be folded to a constant but are not constant expressions as defined by ISO C.
    GCCはC90/C99準拠の定数式を実装しました。これによりISO Cにより定数でないとされている式を定数式として扱っていたコードは警告またはエラーが報告されます。
  • All known target-independent C90 and C90 Amendment 1 conformance bugs, and all known target-independent C99 conformance bugs not related to floating point or extended identifiers, have been fixed.
    すべてのターゲット非依存のC90/C90AMD/C99との非整合性は(浮動小数点関係と拡張識別子を除き)修正されました
  • The C decimal floating point support now includes support for the FLOAT_CONST_DECIMAL64 pragma.
    十進浮動小数点サポートとFLOAT_CONST_DECIMAL64プラグマが導入されました。
  • The named address space feature from ISO/IEC TR 18037 is now supported. This is currently only implemented for the SPU processor.
    ISO/IEC TR18037 名前付きアドレス空間がサポートされました。SPUプロセッサ限定で有効です。
C++(訳注:C++0xサポートのせいで膨大な量だけど嬉しい限りですね!)
  • Improved experimental support for the upcoming C++0x ISO C++ standard, including support for raw strings, lambda expressions and explicit type conversion operators.
    C++0xの実験的サポート(raw strings, lambda expressions, explicit type conversion operators)が拡張されました。
  • When printing the name of a class template specialization, G++ will now omit any template arguments which come from default template arguments. This behavior (and the pretty-printing of function template specializations as template signature and arguments) can be disabled with the -fno-pretty-templates option.
    クラステンプレートの特殊化(訳注:すべてのインスタンス化)名を表示するときにG++はデフォルトテンプレート引数を省略します。この挙動は-fno-pretty-templatesで無効化できます。
  • Access control is now applied to typedef names used in a template, which may cause G++ to reject some ill-formed code that was accepted by earlier releases. The -fno-access-control option can be used as a temporary workaround until the code is corrected.
    アクセス制御がtemplate内部のtypedef名にも適用されるようになり、ill-formedとして拒否するようになりました。コードを修正するまでの間、-fno-access-controlで一時的に回避できます。
  • Compilation time for code that uses templates should now scale linearly with the number of instantiations rather than quadratically, as template instantiations are now looked up using hash tables.
    テンプレート使用時のコンパイル時間がスケールするように、テンプレートインスタンスをハッシュテーブルで管理するようになりました。
  • Declarations of functions that look like builtin declarations of library functions are only considered to be redeclarations if they are declared with extern "C". This may cause problems with code that omits extern "C" on hand-written declarations of C library functions such as abort or memcpy. Such code is ill-formed, but was accepted by earlier releases.
    (訳注:???extern "C"のない再宣言は受け入れないよってこと?識者求む)
  • Diagnostics that used to complain about passing non-POD types to ... or jumping past the declaration of a non-POD variable now check for triviality rather than PODness, as per C++0x.
    non-PODオブジェクトが...(訳注:varargsのこと)に渡されたときや、non-POD変数の宣言が(訳注:gotoやswitchにより)飛ばされた場合、C++0xに規定されているtrivial typeかどうかの判定を行い、診断メッセージを表示します(?)。
  • In C++0x mode local and anonymous classes are now allowed as template arguments, and in declarations of variables and functions with linkage, so long as any such declaration that is used is also defined (DR 757).
    C++0xモードにおいて、ローカルクラス・無名クラスがtemplate引数として使えるようになり、その宣言中の変数と関数にはリンケージが付き、そのようなすべての宣言は定義としても扱われます。
  • Labels may now have attributes, as has been permitted for a while in C. This is only permitted when the label definition and the attribute specifier is followed by a semicolon?i.e., the label applies to an empty statement. The only useful attribute for a label is unused.
    ラベルに(Cで出来たように)属性を付けることが出来るようになりました。これはラベル定義、属性、セミコロンの順番で指定します(訳注: label_name: __attribute__((unused)); の形式)。ラベルにつけることの出来る属性はunusedのみです。
  • G++ now implements DR 176. Previously G++ did not support using the injected-class-name of a template base class as a type name, and lookup of the name found the declaration of the template in the enclosing scope. Now lookup of the name finds the injected-class-name, which can be used either as a type or as a template, depending on whether or not the name is followed by a template argument list. As a result of this change, some code that was previously accepted may be ill-formed because
    • The injected-class-name is not accessible because it's from a private base, or
    • The injected-class-name cannot be used as an argument for a template template parameter.
    In either of these cases, the code can be fixed by adding a nested-name-specifier to explicitly name the template. The first can be worked around with -fno-access-control; the second is only rejected with -pedantic.
    DR 176を実装しました。以前のG++はテンプレートベースクラスをinjected-class-nameとして扱うことが出来ず、内部スコープのテンプレート名宣言として扱っていました。この問題は現在修正され、injected-class-nameとしてルックアップすることが出来、型名または(テンプレート引数の有無に関わらず)テンプレート名として扱うことが出来ます。この結果、以前はコンパイル可能であったいくつかのコードが次の理由により通らなくなる可能性があります。
    • injected-class-nameがprivateなベースクラスを指しているためアクセス不可能であるか、
    • injected-class-nameがtemplate template parameterとして使われている場合
    この場合、nested-name-specifierを追加することにより修正することが出来ます。一つ目の問題は-fno-access-controlにより一時的に回避可能で、二つ目の問題は-pedanticが指定されたときのみエラーになります。
  • A new standard mangling for SIMD vector types has been added, to avoid name clashes on systems with vectors of varying length. By default the compiler still uses the old mangling, but emits aliases with the new mangling on targets that support strong aliases. Users can switch over entirely to the new mangling with -fabi-version=4 or -fabi-version=0. -Wabi will now warn about code that uses the old mangling.
    新しいSIMDベクタ型のマングリングが追加され、可変長ベクタを使うシステムのために長さ情報が削除されました。デフォルトでは古いマングリング規則を使いますが、エイリアスをサポートするシステムでは同時に新しいマングリング名も出力します。新しいマングリング規則を強制するには-fabi-version=4または-fabi-version=0を使います。-Wabiは古いマングリング名を使ったときに警告を発生します。

今日は力尽きたのでここまで・・・