This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/43680] [DR 1022] G++ is too aggressive in optimizing away bounds checking with enums



------- Comment #17 from jason at gcc dot gnu dot org  2010-05-03 21:16 -------
Subject: Bug 43680

Author: jason
Date: Mon May  3 21:16:40 2010
New Revision: 159006

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159006
Log:
        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.

Added:
    trunk/gcc/testsuite/g++.dg/opt/enum2.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c.opt
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/class.c
    trunk/gcc/cp/cvt.c
    trunk/gcc/cp/decl.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/warn/Wswitch-1.C
    trunk/gcc/testsuite/g++.dg/warn/pr33738.C


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]