* Fix for PR sanitize/65000 introduces an unusual gcc_assert
@ 2015-10-28 17:51 Alexander Monakov
2015-10-28 18:09 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Alexander Monakov @ 2015-10-28 17:51 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Henderson
Hello Richard,
Your commit to fix PR 65000 (pasted below) introduced
gcc_assert (ri = (int)ri);
I'm unclear what is meant there; if equality test was meant, that looks
suspicious to me because truncating conversion is implementation-defined.
Can you please comment?
(I found this after noticing assignment-in-assertion in nvptx.c, but apart
from two instances there and this one, I didn't find others in GCC)
Thanks.
Alexander
PR sanitize/65000
* tree-eh.c (mark_reachable_handlers): Mark source and destination
regions of __builtin_eh_copy_values.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220626 138bc75d-0d04-0410-961f-82ee72b054a4
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 159fa2b..3c45f37 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -3859,6 +3859,17 @@ mark_reachable_handlers (sbitmap *r_reachablep, sbitmap *lp_reachablep)
gimple_eh_dispatch_region (
as_a <geh_dispatch *> (stmt)));
break;
+ case GIMPLE_CALL:
+ if (gimple_call_builtin_p (stmt, BUILT_IN_EH_COPY_VALUES))
+ for (int i = 0; i < 2; ++i)
+ {
+ tree rt = gimple_call_arg (stmt, i);
+ HOST_WIDE_INT ri = tree_to_shwi (rt);
+
+ gcc_assert (ri = (int)ri);
+ bitmap_set_bit (r_reachable, ri);
+ }
+ break;
default:
break;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix for PR sanitize/65000 introduces an unusual gcc_assert
2015-10-28 17:51 Fix for PR sanitize/65000 introduces an unusual gcc_assert Alexander Monakov
@ 2015-10-28 18:09 ` Richard Henderson
2015-10-28 19:18 ` Richard Biener
0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2015-10-28 18:09 UTC (permalink / raw)
To: Alexander Monakov, gcc-patches
On 10/28/2015 10:47 AM, Alexander Monakov wrote:
> Hello Richard,
>
> Your commit to fix PR 65000 (pasted below) introduced
> gcc_assert (ri = (int)ri);
>
> I'm unclear what is meant there; if equality test was meant, that looks
> suspicious to me because truncating conversion is implementation-defined.
Of course equality was meant. And since the argument to bitmap_set_bit is of
type int, the same truncation would happen there. So this just verifies that
we don't lose information during the conversion.
Since implementation defined doesn't mean undefined, I see no problem.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix for PR sanitize/65000 introduces an unusual gcc_assert
2015-10-28 18:09 ` Richard Henderson
@ 2015-10-28 19:18 ` Richard Biener
2015-10-28 19:43 ` Richard Henderson
0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2015-10-28 19:18 UTC (permalink / raw)
To: Richard Henderson, Alexander Monakov, gcc-patches
On October 28, 2015 7:07:54 PM GMT+01:00, Richard Henderson <rth@redhat.com> wrote:
>On 10/28/2015 10:47 AM, Alexander Monakov wrote:
>> Hello Richard,
>>
>> Your commit to fix PR 65000 (pasted below) introduced
>> gcc_assert (ri = (int)ri);
>>
>> I'm unclear what is meant there; if equality test was meant, that
>looks
>> suspicious to me because truncating conversion is
>implementation-defined.
>
>Of course equality was meant. And since the argument to bitmap_set_bit
>is of
>type int, the same truncation would happen there. So this just
>verifies that
>we don't lose information during the conversion.
>
>Since implementation defined doesn't mean undefined, I see no problem.
And ri == 0 cannot happen?
>
>r~
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Fix for PR sanitize/65000 introduces an unusual gcc_assert
2015-10-28 19:18 ` Richard Biener
@ 2015-10-28 19:43 ` Richard Henderson
0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2015-10-28 19:43 UTC (permalink / raw)
To: Richard Biener, Alexander Monakov, gcc-patches
On 10/28/2015 12:09 PM, Richard Biener wrote:
> On October 28, 2015 7:07:54 PM GMT+01:00, Richard Henderson <rth@redhat.com> wrote:
>> On 10/28/2015 10:47 AM, Alexander Monakov wrote:
>>> Hello Richard,
>>>
>>> Your commit to fix PR 65000 (pasted below) introduced
>>> gcc_assert (ri = (int)ri);
>>>
>>> I'm unclear what is meant there; if equality test was meant, that
>> looks
>>> suspicious to me because truncating conversion is
>> implementation-defined.
>>
>> Of course equality was meant. And since the argument to bitmap_set_bit
>> is of
>> type int, the same truncation would happen there. So this just
>> verifies that
>> we don't lose information during the conversion.
>>
>> Since implementation defined doesn't mean undefined, I see no problem.
>
> And ri == 0 cannot happen?
IIRC, 0 is reserved for nothrow, so exception indicies are 1 based.
That said, I've fixed the assert in the obvious way.
r~
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-28 19:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-28 17:51 Fix for PR sanitize/65000 introduces an unusual gcc_assert Alexander Monakov
2015-10-28 18:09 ` Richard Henderson
2015-10-28 19:18 ` Richard Biener
2015-10-28 19:43 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).