diff options
author | Jason Merrill <jason@redhat.com> | 2010-05-03 17:16:40 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-05-03 17:16:40 -0400 |
commit | cbb4feb38e39bac728d1a0d053f14d9868d99e8d (patch) | |
tree | f66f3527bad37dd8ad2f5c0b5d0966b9ca678f5b /gcc/doc | |
parent | e492f63ba96ba25a74ebbfab09cb12d403c0bc1d (diff) | |
download | gcc-cbb4feb38e39bac728d1a0d053f14d9868d99e8d.zip gcc-cbb4feb38e39bac728d1a0d053f14d9868d99e8d.tar.gz gcc-cbb4feb38e39bac728d1a0d053f14d9868d99e8d.tar.bz2 |
re PR c++/43680 ([DR 1022] G++ is too aggressive in optimizing away bounds checking with enums)
PR c++/43680
gcc:
* c.opt (-fstrict-enums): New.
* doc/invoke.texi (C++ Dialect Options): Document -fstrict-enums.
gcc/cp:
* decl.c (finish_enum): Use the TYPE_MIN_VALUE and TYPE_MAX_VALUE
from the selected underlying type unless -fstrict-enums. Set
ENUM_UNDERLYING_TYPE to have the restricted range.
* cvt.c (type_promotes_to): Use ENUM_UNDERLYING_TYPE.
* class.c (check_bitfield_decl): Likewise.
From-SVN: r159006
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/invoke.texi | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index fefb0ab..b2fbd48 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -1982,6 +1982,15 @@ unambiguous base classes. Emit statistics about front-end processing at the end of the compilation. This information is generally only useful to the G++ development team. +@item -fstrict-enums +@opindex fstrict-enums +Allow the compiler to optimize using the assumption that a value of +enumeration type can only be one of the values of the enumeration (as +defined in the C++ standard; basically, a value which can be +represented in the minimum number of bits needed to represent all the +enumerators). This assumption may not be valid if the program uses a +cast to convert an arbitrary integer value to the enumeration type. + @item -ftemplate-depth=@var{n} @opindex ftemplate-depth Set the maximum instantiation depth for template classes to @var{n}. |