Message ID | 56130763.4070206@gmail.com |
---|---|
State | New |
Headers | show |
On 10/05/2015 05:27 PM, Mikhail Maltsev wrote: > 3. Another one: gcc.c-torture/compile/pr52073.c which is, I guess, caused by > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816 (the backtrace is the same, > at least). FYI, this is fixed on the trunk. jeff
On 10/05/2015 05:27 PM, Mikhail Maltsev wrote: > Hi! > > This is an updated series of patches which converts 'ENABLE_CHECKING' macro into > a flag, 'flag_checking' (and 'CHECKING_P' macro in several cases). For now > flag_checking is always initialized with the value of 'CHECKING_P', but later it > can be turned into a proper command-line flag and probably split into several > checks. I also added several function which verify internal data structures when > flag_checking is enabled (e.g. checking_verify_flow_info which calls > verify_flow_info). These functions make their callers look somewhat cleaner. > > The cases where I left 'CHECKING_P' are: > 1. libcpp (turn ICE after an error into fatal error) and pretty-printers (that > would require to pass flag_checking to libcpp just for this single case). > 2. Code which fills memory in the pools with some predefined patterns in > deallocation methods (this would add some overhead to each deallocation), though > I have not measured performance impact yet. > 3. Generators and generated code. > 4. Target-specific code > 5. 'struct lra_reg' which has an additional field in checking build > 6. Likewise, 'struct moveop_static_params' in insn scheduler and > 'cumulative_args_t' in target.h. > 7. macro-related code in libcpp (for the same reason) > 8. real.c and fwprop.c - I'll profile these and also fix to use flag_checking if > there won't be any measurable overhead. > > There are 9 patches: > 1. Add flag_checking and CHECKING_P macros > 2. Use CHECKING_P in libcpp > 3. Ada and Java frontends > 4. Fortran frontend > 5. Pool allocators > 6. Generator programs > 7. Most of middle-end (GIMPLE, IPA, RTL) - it can be split further, if needed. > 8. Target-specific code > 9. C++ frontend - in progress (I will send this part soon). > > Some issues related to checking builds: > 1. Useless check in graphite:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67842 > 2. I found a test which fails only on release builds: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58583 (reopened) > 3. Another one: gcc.c-torture/compile/pr52073.c which is, I guess, caused by > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67816 (the backtrace is the same, > at least). > > Each patch (when applied on top of all the previous ones) compiles in both > checking and release builds. The combined patch passes bootstrap and regression > tests in checking an release builds (apart from 2 issues mentioned above) on > x86_64-linux. I'll also run it through config-list.mk. > > -- Regards, Mikhail Maltsev gcc/ChangeLog: 2015-10-05 Mikhail Maltsev > <maltsevm@gmail.com> * common.opt: Add flag_checking. * system.h > (CHECKING_P): Define. libcpp/ChangeLog: 2015-10-05 Mikhail Maltsev > <maltsevm@gmail.com> * system.h (CHECKING_P, gcc_checking_assert): Define. > > > 0001-Prerequisites-for-ENABLE_CHECKING-conversion.patch > > > From 8096ea4714b3b7a96b414a70fd0de34e5e5a707a Mon Sep 17 00:00:00 2001 > From: Mikhail Maltsev<maltsevm@gmail.com> > Date: Sun, 20 Sep 2015 04:30:42 +0300 > Subject: [PATCH 1/9] Prerequisites for ENABLE_CHECKING conversion > > Define CHECKING_P macros. Add flag_checking. > Define gcc_checking_assert in libcpp > --- > gcc/common.opt | 5 +++++ > gcc/system.h | 3 +++ > libcpp/system.h | 8 ++++++++ > 3 files changed, 16 insertions(+) I committed this prerequisite patch to the trunk. jeff
From 8096ea4714b3b7a96b414a70fd0de34e5e5a707a Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev <maltsevm@gmail.com> Date: Sun, 20 Sep 2015 04:30:42 +0300 Subject: [PATCH 1/9] Prerequisites for ENABLE_CHECKING conversion Define CHECKING_P macros. Add flag_checking. Define gcc_checking_assert in libcpp --- gcc/common.opt | 5 +++++ gcc/system.h | 3 +++ libcpp/system.h | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/gcc/common.opt b/gcc/common.opt index b0f70fb..5060208 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -46,6 +46,11 @@ int optimize_fast Variable bool in_lto_p = false +; Enable additional checks of internal state consistency, which may slow +; the compiler down. +Variable +bool flag_checking = CHECKING_P + ; 0 means straightforward implementation of complex divide acceptable. ; 1 means wide ranges of inputs must work for complex divide. ; 2 means C99-like requirements for complex multiply and divide. diff --git a/gcc/system.h b/gcc/system.h index f1694b9..dc3b96d 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -716,8 +716,11 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; #ifdef ENABLE_CHECKING #define gcc_checking_assert(EXPR) gcc_assert (EXPR) +#define CHECKING_P 1 #else +/* N.B.: in release build EXPR is not evaluated. */ #define gcc_checking_assert(EXPR) ((void)(0 && (EXPR))) +#define CHECKING_P 0 #endif /* Use gcc_unreachable() to mark unreachable locations (like an diff --git a/libcpp/system.h b/libcpp/system.h index a2e8c26..e070bc9 100644 --- a/libcpp/system.h +++ b/libcpp/system.h @@ -391,6 +391,14 @@ extern void abort (void); #define __builtin_expect(a, b) (a) #endif +#ifdef ENABLE_CHECKING +#define gcc_checking_assert(EXPR) gcc_assert (EXPR) +#define CHECKING_P 1 +#else +#define gcc_checking_assert(EXPR) ((void)(0 && (EXPR))) +#define CHECKING_P 0 +#endif + /* Provide a fake boolean type. We make no attempt to use the C99 _Bool, as it may not be available in the bootstrap compiler, and even if it is, it is liable to be buggy. -- 2.1.4