From: "Martin Liška" <mliska@suse.cz>
To: Jeff Law <law@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix bitmap_bit_in_range_p (PR tree-optimization/82493).
Date: Mon, 16 Oct 2017 12:15:00 -0000 [thread overview]
Message-ID: <4f7dc604-8b86-3f81-6d3c-5aaa3d46ac7b@suse.cz> (raw)
In-Reply-To: <190c5684-631c-a7a0-631e-c1296081e3f0@redhat.com>
On 10/13/2017 04:59 PM, Jeff Law wrote:
> On 10/13/2017 07:02 AM, Martin Liška wrote:
>> On 10/12/2017 11:54 PM, Jeff Law wrote:
>>> On 10/11/2017 12:13 AM, Martin Liška wrote:
>>>> 2017-10-10 Martin Liska <mliska@suse.cz>
>>>>
>>>> PR tree-optimization/82493
>>>> * sbitmap.c (bitmap_bit_in_range_p): Fix the implementation.
>>>> (test_range_functions): New function.
>>>> (sbitmap_c_tests): Likewise.
>>>> * selftest-run-tests.c (selftest::run_tests): Run new tests.
>>>> * selftest.h (sbitmap_c_tests): New function.
>>> I went ahead and committed this along with a patch to fix the off-by-one
>>> error in live_bytes_read. Bootstrapped and regression tested on x86.
>>>
>>> Actual patch attached for archival purposes.
>>>
>>> Jeff
>>>
>>
>> Hello.
>>
>> I wrote a patch that adds various gcc_checking_asserts and I hit following:
>>
>> ./xgcc -B. /home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/char_result_12.f90 -c -O2
>> during GIMPLE pass: dse
>> /home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/char_result_12.f90:7:0:
>>
>> program testat
>>
>> internal compiler error: in bitmap_check_index, at sbitmap.h:105
>> 0x1c014c1 bitmap_check_index
>> ../../gcc/sbitmap.h:105
>> 0x1c01fa7 bitmap_bit_in_range_p(simple_bitmap_def const*, unsigned int, unsigned int)
>> ../../gcc/sbitmap.c:335
>> 0x1179002 live_bytes_read
>> ../../gcc/tree-ssa-dse.c:497
>> 0x117935a dse_classify_store
>> ../../gcc/tree-ssa-dse.c:595
>> 0x1179947 dse_dom_walker::dse_optimize_stmt(gimple_stmt_iterator*)
>> ../../gcc/tree-ssa-dse.c:786
>> 0x1179b6e dse_dom_walker::before_dom_children(basic_block_def*)
>> ../../gcc/tree-ssa-dse.c:853
>> 0x1a6f659 dom_walker::walk(basic_block_def*)
>> ../../gcc/domwalk.c:308
>> 0x1179cb9 execute
>> ../../gcc/tree-ssa-dse.c:907
>>
>> Where we call:
>> Breakpoint 1, bitmap_bit_in_range_p (bmap=0x29d6cd0, start=0, end=515) at ../../gcc/sbitmap.c:335
>> 335 bitmap_check_index (bmap, end);
>> (gdb) p *bmap
>> $1 = {n_bits = 256, size = 4, elms = {255}}
>>
>> Is it a valid call or should caller check indices?
> It doesn't look valid to me. I'll dig into it.
>
> In general the sbitmap interface requires callers to DTRT -- failure can
> easily lead to an out of bounds read or write. It's one of the things I
> really dislike about the sbitmap implementation.
>
> So it's safe to assume that I'm fully supportive of adding more testing
> to catch this kind thing.
>
> Jeff
>
Good.
Should I prepare fix for the ICE I mentioned or have you been working on that?
Thanks,
Martin
next prev parent reply other threads:[~2017-10-16 12:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 6:15 Martin Liška
2017-10-11 17:58 ` Jeff Law
2017-10-12 4:48 ` Jeff Law
2017-10-12 22:16 ` Jeff Law
2017-10-13 8:01 ` Martin Liška
2017-10-13 13:13 ` Martin Liška
2017-10-13 14:17 ` Jeff Law
2017-10-13 13:03 ` Martin Liška
2017-10-13 15:04 ` Jeff Law
2017-10-16 12:15 ` Martin Liška [this message]
2017-10-16 14:53 ` Jeff Law
2017-10-17 17:33 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4f7dc604-8b86-3f81-6d3c-5aaa3d46ac7b@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).