Bug 326243 - libs/kotext/styles/KoCharacterStyle.cpp:1938:42: warning: iteration 3u invokes undefined behavior
Summary: libs/kotext/styles/KoCharacterStyle.cpp:1938:42: warning: iteration 3u invoke...
Status: RESOLVED FIXED
Alias: None
Product: calligracommon
Classification: Applications
Component: general (show other bugs)
Version: 2.7.4
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Calligra Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-18 22:38 UTC by Dennis Schridde
Modified: 2013-11-22 10:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Schridde 2013-10-18 22:38:56 UTC
GCC 4.8 says:
---
calligra-2.7.4/libs/kotext/styles/KoCharacterStyle.cpp:1938:42: warning: iteration 3u invokes undefined behavior [-Waggressive-loop-optimizations]
---

The code is:
---
    for (unsigned int i = 0; i < sizeof(keepProperties); ++i) {
        if (hasProperty(keepProperties[i])) {
            keep.insert(keepProperties[i], value(keepProperties[i]));
---

It should be: i < sizeof(keepProperties)/sizeof(*keepProperties)

Reproducible: Always
Comment 1 Camilla Boemann 2013-11-10 11:47:59 UTC
Git commit 50a16640316616c3ce7562a6792bdc82ce11b9e5 by C. Boemann.
Committed on 10/11/2013 at 11:42.
Pushed by boemann into branch 'master'.

Fix unsafe looping

thanks Dennis for report and solution suggestion

M  +1    -1    libs/kotext/styles/KoCharacterStyle.cpp

http://commits.kde.org/calligra/50a16640316616c3ce7562a6792bdc82ce11b9e5
Comment 2 Halla Rempt 2013-11-22 10:56:53 UTC
Git commit 8c429e7585168e613440d07228c756109de8f2e2 by Boudewijn Rempt, on behalf of C. Boemann.
Committed on 10/11/2013 at 11:42.
Pushed by rempt into branch 'calligra/2.7'.

Fix unsafe looping

thanks Dennis for report and solution suggestion

M  +1    -1    libs/kotext/styles/KoCharacterStyle.cpp

http://commits.kde.org/calligra/8c429e7585168e613440d07228c756109de8f2e2