]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/cp/class.c
re PR c++/43680 ([DR 1022] G++ is too aggressive in optimizing away bounds checking...
authorJason Merrill <jason@redhat.com>
Mon, 3 May 2010 21:16:40 +0000 (17:16 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 3 May 2010 21:16:40 +0000 (17:16 -0400)
commitcbb4feb38e39bac728d1a0d053f14d9868d99e8d
treef66f3527bad37dd8ad2f5c0b5d0966b9ca678f5b
parente492f63ba96ba25a74ebbfab09cb12d403c0bc1d
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
gcc/ChangeLog
gcc/c.opt
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cvt.c
gcc/cp/decl.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/enum2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wswitch-1.C
gcc/testsuite/g++.dg/warn/pr33738.C