[PATCH] Strenghten assumption about gswitch statements.

Martin Liška mliska@suse.cz
Mon Oct 22 14:08:00 GMT 2018


On 8/28/18 12:10 PM, Richard Biener wrote:
> On Tue, Aug 28, 2018 at 9:11 AM Martin Liška <mliska@suse.cz> wrote:
>>
>> On 08/27/2018 05:21 PM, Richard Biener wrote:
>>> On Mon, Aug 27, 2018 at 4:05 PM Martin Liška <mliska@suse.cz> wrote:
>>>>
>>>> Hi.
>>>>
>>>> Now we should not meet a degenerated gswitch statements.
>>>>
>>>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>>>
>>>> Ready to be installed?
>>>
>>> Hum.  This relies on us doing CFG cleanup.  Do we really want
>>> find_taken_edge to ICE when called between CFG construction
>>> and the first such call?  That is, I think this kind of "verification"
>>> belongs in the CFG verifier.  Note that there's GIMPLE switches
>>> before we have a CFG and those are not sanitized (at least
>>> not that I know of).  So we cannot really declare single-case
>>> switch stmts invalid?
>>
>> Thanks for explanation. In case of switch_conversion::expand, may I apply
>> patch for that? It should not see a degenerated switch, or do I miss
>> something?
> 
> Hopefully not.

I missed as it caused PR87686. Thus I'm reverting that.

Patch is tested on x86_64-linux-gnu.

Martin

> 
> So that part is OK.
> 
> Richard.
> 
>> Martin
>>
>>>
>>> Thanks,
>>> Richard.
>>>
>>>> Martin
>>>>
>>>> gcc/ChangeLog:
>>>>
>>>> 2018-08-27  Martin Liska  <mliska@suse.cz>
>>>>
>>>>         * tree-cfg.c (find_taken_edge_switch_expr): Replace not possible
>>>>         condition with assert.
>>>>         * tree-switch-conversion.c (switch_conversion::expand):
>>>>         Likewise.
>>>> ---
>>>>  gcc/tree-cfg.c               | 17 +++++++----------
>>>>  gcc/tree-switch-conversion.c |  9 +--------
>>>>  2 files changed, 8 insertions(+), 18 deletions(-)
>>>>
>>>>
>>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Revert-r263947.patch
Type: text/x-patch
Size: 2182 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20181022/569934e1/attachment.bin>


More information about the Gcc-patches mailing list