Message ID | CA+yXCZBiSOs8AxOAs93K65kvJBpewUjiYmy5UtcSAawB1Suzmg@mail.gmail.com |
---|---|
State | New |
Headers | show |
On 06/29/2015 09:07 PM, Kito Cheng wrote: > Hi all: > > This patch seem will broken when disable assert checking for c6x.... > > Index: gcc/config/c6x/c6x.c > =================================================================== > --- gcc/config/c6x/c6x.c (revision 225104) > +++ gcc/config/c6x/c6x.c (working copy) > @@ -3516,7 +3516,7 @@ try_rename_operands (rtx_insn *head, rtx > best_reg = > find_rename_reg (this_head, super_class, &unavailable, old_reg, true); > > - regrename_do_replace (this_head, best_reg); > + gcc_assert (regrename_do_replace (this_head, best_reg)); > > count_unit_reqs (new_reqs, head, PREV_INSN (tail)); > merge_unit_reqs (new_reqs); > @@ -3529,7 +3529,7 @@ try_rename_operands (rtx_insn *head, rtx > unit_req_imbalance (reqs), unit_req_imbalance (new_reqs)); > } > if (unit_req_imbalance (new_reqs) > unit_req_imbalance (reqs)) > - regrename_do_replace (this_head, old_reg); > + gcc_assert (regrename_do_replace (this_head, old_reg)); > else > memcpy (reqs, new_reqs, sizeof (unit_req_table)); > I'm sorry; do you have a suggestion for a fix? I thought this was the change I was asked to make, and as I noted previously, I'm not set up to test (or even build) for this target. -Sandra the obviously confused :-(
On 2015/6/30 12:22 PM, Sandra Loosemore wrote: > On 06/29/2015 09:07 PM, Kito Cheng wrote: >> Hi all: >> >> This patch seem will broken when disable assert checking for c6x.... >> >> Index: gcc/config/c6x/c6x.c >> =================================================================== >> --- gcc/config/c6x/c6x.c (revision 225104) >> +++ gcc/config/c6x/c6x.c (working copy) >> @@ -3516,7 +3516,7 @@ try_rename_operands (rtx_insn *head, rtx >> best_reg = >> find_rename_reg (this_head, super_class, &unavailable, old_reg, true); >> >> - regrename_do_replace (this_head, best_reg); >> + gcc_assert (regrename_do_replace (this_head, best_reg)); >> >> count_unit_reqs (new_reqs, head, PREV_INSN (tail)); >> merge_unit_reqs (new_reqs); >> @@ -3529,7 +3529,7 @@ try_rename_operands (rtx_insn *head, rtx >> unit_req_imbalance (reqs), unit_req_imbalance (new_reqs)); >> } >> if (unit_req_imbalance (new_reqs) > unit_req_imbalance (reqs)) >> - regrename_do_replace (this_head, old_reg); >> + gcc_assert (regrename_do_replace (this_head, old_reg)); >> else >> memcpy (reqs, new_reqs, sizeof (unit_req_table)); >> > > I'm sorry; do you have a suggestion for a fix? I thought this was the change I was asked to make, and as I noted previously, I'm not set up to test (or even build) for this target. > > -Sandra the obviously confused :-( You probably have to separate out the regrename_do_replace() bool result into a variable, placing the whole call into the gcc_assert() might make it disappear when assertions are turned off. Chung-Lin
On 2015/6/30 下午 01:13, Chung-Lin Tang wrote: > On 2015/6/30 12:22 PM, Sandra Loosemore wrote: >> On 06/29/2015 09:07 PM, Kito Cheng wrote: >>> Hi all: >>> >>> This patch seem will broken when disable assert checking for c6x.... >>> >>> Index: gcc/config/c6x/c6x.c >>> =================================================================== >>> --- gcc/config/c6x/c6x.c (revision 225104) >>> +++ gcc/config/c6x/c6x.c (working copy) >>> @@ -3516,7 +3516,7 @@ try_rename_operands (rtx_insn *head, rtx >>> best_reg = >>> find_rename_reg (this_head, super_class, &unavailable, old_reg, true); >>> >>> - regrename_do_replace (this_head, best_reg); >>> + gcc_assert (regrename_do_replace (this_head, best_reg)); >>> >>> count_unit_reqs (new_reqs, head, PREV_INSN (tail)); >>> merge_unit_reqs (new_reqs); >>> @@ -3529,7 +3529,7 @@ try_rename_operands (rtx_insn *head, rtx >>> unit_req_imbalance (reqs), unit_req_imbalance (new_reqs)); >>> } >>> if (unit_req_imbalance (new_reqs) > unit_req_imbalance (reqs)) >>> - regrename_do_replace (this_head, old_reg); >>> + gcc_assert (regrename_do_replace (this_head, old_reg)); >>> else >>> memcpy (reqs, new_reqs, sizeof (unit_req_table)); >>> >> >> I'm sorry; do you have a suggestion for a fix? I thought this was the change I was asked to make, and as I noted previously, I'm not set up to test (or even build) for this target. >> >> -Sandra the obviously confused :-( > > You probably have to separate out the regrename_do_replace() bool result into a variable, > placing the whole call into the gcc_assert() might make it disappear when assertions are turned off. I notice the way gcc_assert() is defined in system.h now, the test won't disappear even when runtime checks are disabled, though you might still adjust it to avoid any programmer confusion. Chung-Lin
> I notice the way gcc_assert() is defined in system.h now, the test won't > disappear even when runtime checks are disabled, though you might still > adjust it to avoid any programmer confusion. It will disappear at run time, see the definition: /* Include EXPR, so that unused variable warnings do not occur. */ #define gcc_assert(EXPR) ((void)(0 && (EXPR))) so you really need to use a separate variable.
On 2015/6/30 05:06 PM, Eric Botcazou wrote: >> I notice the way gcc_assert() is defined in system.h now, the test won't >> disappear even when runtime checks are disabled, though you might still >> adjust it to avoid any programmer confusion. > > It will disappear at run time, see the definition: > > /* Include EXPR, so that unused variable warnings do not occur. */ > #define gcc_assert(EXPR) ((void)(0 && (EXPR))) > > so you really need to use a separate variable. > I was referring to this one: #if ENABLE_ASSERT_CHECKING ... #elif (GCC_VERSION >= 4005) #define gcc_assert(EXPR) \ ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0)) #else ... But yeah, I guess older GCCs could be used to build a toolchain, so a separate variable should be used. Chung-Lin
Index: gcc/config/c6x/c6x.c =================================================================== --- gcc/config/c6x/c6x.c (revision 225104) +++ gcc/config/c6x/c6x.c (working copy) @@ -3516,7 +3516,7 @@ try_rename_operands (rtx_insn *head, rtx best_reg = find_rename_reg (this_head, super_class, &unavailable, old_reg, true); - regrename_do_replace (this_head, best_reg); + gcc_assert (regrename_do_replace (this_head, best_reg)); count_unit_reqs (new_reqs, head, PREV_INSN (tail)); merge_unit_reqs (new_reqs); @@ -3529,7 +3529,7 @@ try_rename_operands (rtx_insn *head, rtx unit_req_imbalance (reqs), unit_req_imbalance (new_reqs)); } if (unit_req_imbalance (new_reqs) > unit_req_imbalance (reqs)) - regrename_do_replace (this_head, old_reg); + gcc_assert (regrename_do_replace (this_head, old_reg)); else memcpy (reqs, new_reqs, sizeof (unit_req_table));