avoid Asan runtime error: shift exponent -1 is negative
ClosedPublic

Authored by jtamate on Mar 30 2018, 5:28 PM.

Details

Summary

Avoid doing a 1<<-1.

Test Plan

Before: frameworks/ktexteditor/src/completion/katecompletionconfig.cpp:195:33: runtime error: shift exponent -1 is negative
after: silence

Diff Detail

Repository
R39 KTextEditor
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
jtamate created this revision.Mar 30 2018, 5:28 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptMar 30 2018, 5:28 PM
jtamate requested review of this revision.Mar 30 2018, 5:28 PM
brauch added a subscriber: brauch.Mar 30 2018, 5:57 PM

Change looks good (the previous code definitely looks like nonsense), but what does this mean for existing settings, saved previously?

mwolff added a subscriber: mwolff.Apr 3 2018, 7:46 PM

maybe instead make it explicit what the old code did instead? i.e. check what you get from GCC for "1 << -1" and then use that when i == 0

jtamate updated this revision to Diff 31271.Apr 4 2018, 10:14 AM

Implemented mwolf solution.

mwolff accepted this revision.Apr 4 2018, 10:23 AM

thanks

This revision is now accepted and ready to land.Apr 4 2018, 10:23 AM
This revision was automatically updated to reflect the committed changes.