Bug 101037

Summary: compiler warnings in gthumb
Product: [Retired] Red Hat Linux Reporter: d.binderman
Component: gthumbAssignee: Christopher Aillon <caillon>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9Keywords: MoveUpstream, Triaged
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-08-24 21:02:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description d.binderman 2003-07-28 18:59:23 UTC
Description of problem:
Hello there,

I have just tried to compile package gthumb-2.0.1-1 from Redhat 9.0
with compiler flag -Wall.

The compiler said

preferences.c:351: warning: operation on `i' may be undefined
preferences.c:352: warning: operation on `i' may be undefined
preferences.c:353: warning: operation on `i' may be undefined
preferences.c:397: warning: operation on `i' may be undefined
preferences.c:398: warning: operation on `i' may be undefined
preferences.c:399: warning: operation on `i' may be undefined

The source code is

        *r = dec (hex[i++]) * 16 + dec (hex[i++]);
        *g = dec (hex[i++]) * 16 + dec (hex[i++]);
        *b = dec (hex[i++]) * 16 + dec (hex[i++]);
It is a basic fact of the C language that this kind of increment
produces undefined code. Much better to write it something like

        *r = dec (hex[i]) * 16 + dec (hex[i + 1]);
        i += 2;
        *g = dec (hex[i]) * 16 + dec (hex[i + 1]);
        i += 2;
        *b = dec (hex[i]) * 16 + dec (hex[i + 1]);
        i += 2;


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
    
Actual results:


Expected results:


Additional info:

Comment 1 Christopher Aillon 2004-08-26 05:50:41 UTC
*** Bug 110809 has been marked as a duplicate of this bug. ***