Bug 101037 - compiler warnings in gthumb
compiler warnings in gthumb
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gthumb (Show other bugs)
9
All Linux
medium Severity medium
: ---
: ---
Assigned To: Christopher Aillon
: MoveUpstream, Triaged
: 110809 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-07-28 14:59 EDT by d.binderman
Modified: 2007-04-18 12:56 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-08-24 17:02:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2003-07-28 14:59:23 EDT
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 01:50:41 EDT
*** Bug 110809 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.