RESOLVED FIXED 130634
Remove Dead Stores from editing directory
https://bugs.webkit.org/show_bug.cgi?id=130634
Summary Remove Dead Stores from editing directory
Jinwoo Song
Reported 2014-03-21 23:24:15 PDT
Remove Dead Stores from editing directory which assigning a value to a variable and never reading that value.
Attachments
Patch (2.81 KB, patch)
2014-03-21 23:25 PDT, Jinwoo Song
no flags
Patch (1.98 KB, patch)
2014-03-23 21:41 PDT, Jinwoo Song
no flags
Jinwoo Song
Comment 1 2014-03-21 23:25:33 PDT
Darin Adler
Comment 2 2014-03-22 07:57:15 PDT
Comment on attachment 227536 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227536&action=review > Source/WebCore/editing/CompositeEditCommand.cpp:-843 > - gapEnd = std::min(gapEnd, end); I suspect the dead store here indicates a bug. I think that gapLen needs to be recomputed. Instead of removing this line of code, we should add a line of code: gapLen = gapEnd - gapStart; But of course, we also need to construct a test case to demonstrate that the code is incorrect, which could be difficult.
Darin Adler
Comment 3 2014-03-22 07:57:45 PDT
(In reply to comment #0) > Remove Dead Stores from editing directory which assigning a value to a variable and never reading that value. I assume you are finding these with a tool or compiler warning. Could you specify what compiler this is and what warning option, or what tool?
Jinwoo Song
Comment 4 2014-03-23 19:20:21 PDT
Comment on attachment 227536 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227536&action=review >> Source/WebCore/editing/CompositeEditCommand.cpp:-843 >> - gapEnd = std::min(gapEnd, end); > > I suspect the dead store here indicates a bug. I think that gapLen needs to be recomputed. Instead of removing this line of code, we should add a line of code: > > gapLen = gapEnd - gapStart; > > But of course, we also need to construct a test case to demonstrate that the code is incorrect, which could be difficult. Then I'll remain this line and make an another bug to follow up this issue.
Jinwoo Song
Comment 5 2014-03-23 19:23:31 PDT
(In reply to comment #3) > (In reply to comment #0) > > Remove Dead Stores from editing directory which assigning a value to a variable and never reading that value. > > I assume you are finding these with a tool or compiler warning. Could you specify what compiler this is and what warning option, or what tool? I just run a static analyzer built into Xcode (on Mac). :)
Jinwoo Song
Comment 6 2014-03-23 21:41:02 PDT
Created attachment 227622 [details] Patch Do not remove dead store in CompositeEditCommand.cpp according to Darin's comment. I'll make another bug for tracking this one.
Jinwoo Song
Comment 7 2014-03-23 21:47:44 PDT
Comment on attachment 227536 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=227536&action=review >>> Source/WebCore/editing/CompositeEditCommand.cpp:-843 >>> - gapEnd = std::min(gapEnd, end); >> >> I suspect the dead store here indicates a bug. I think that gapLen needs to be recomputed. Instead of removing this line of code, we should add a line of code: >> >> gapLen = gapEnd - gapStart; >> >> But of course, we also need to construct a test case to demonstrate that the code is incorrect, which could be difficult. > > Then I'll remain this line and make an another bug to follow up this issue. Created a bug, https://bugs.webkit.org/show_bug.cgi?id=130658
WebKit Commit Bot
Comment 8 2014-03-23 22:17:00 PDT
Comment on attachment 227622 [details] Patch Clearing flags on attachment: 227622 Committed r166150: <http://trac.webkit.org/changeset/166150>
WebKit Commit Bot
Comment 9 2014-03-23 22:17:04 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.