Bug 79640 - undefined behavior C statements in Imlib
Summary: undefined behavior C statements in Imlib
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: imlib
Version: 8.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-12-14 10:42 UTC by d.binderman
Modified: 2013-04-02 04:17 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-02-08 05:39:48 UTC
Embargoed:


Attachments (Terms of Use)

Description d.binderman 2002-12-14 10:42:03 UTC
Description of problem:

Hello there,

I just tried to compile package imlib-1.9.13-9 from Redhat 8.0.

Here are some of the compiler messages.

io-ppm.c:179: warning: operation on `a' may be undefined
io-ppm.c:180: warning: operation on `a' may be undefined
io-ppm.c:197: warning: operation on `a' may be undefined
io-ppm.c:198: warning: operation on `a' may be undefined
load.c:1467: warning: operation on `a' may be undefined
load.c:1468: warning: operation on `a' may be undefined
load.c:1485: warning: operation on `a' may be undefined
load.c:1486: warning: operation on `a' may be undefined

Here is a patch which shuts up the compiler.

*** ./gdk_imlib/io-ppm.c.old	2002-11-28 18:47:55.000000000 +0000
--- ./gdk_imlib/io-ppm.c	2002-11-28 18:48:57.000000000 +0000
***************
*** 176,183 ****
  			  if ((i > 1) && (isdigit(s[i - 2])))
  			    {
  			      ptr[a++] = ((atoi(s)) * 255) / scale;
! 			      ptr[a++] = ptr[a - 1];
! 			      ptr[a++] = ptr[a - 1];
  			    }
  			  i = 0;
  			}
--- 176,185 ----
  			  if ((i > 1) && (isdigit(s[i - 2])))
  			    {
  			      ptr[a++] = ((atoi(s)) * 255) / scale;
! 			      ptr[a] = ptr[a - 1];
! 				a++;
! 			      ptr[a] = ptr[a - 1];
! 				a++;
  			    }
  			  i = 0;
  			}
***************
*** 194,201 ****
  			  if ((i > 1) && (isdigit(s[i - 2])))
  			    {
  			      ptr[a++] = atoi(s);
! 			      ptr[a++] = ptr[a - 1];
! 			      ptr[a++] = ptr[a - 1];
  			    }
  			  i = 0;
  			}
--- 196,205 ----
  			  if ((i > 1) && (isdigit(s[i - 2])))
  			    {
  			      ptr[a++] = atoi(s);
! 			      ptr[a] = ptr[a - 1];
! 			      a++;
! 			      ptr[a] = ptr[a - 1];
! 			      a++;
  			    }
  			  i = 0;
  			}
*** ./Imlib/load.c.old	2002-11-28 18:49:47.000000000 +0000
--- ./Imlib/load.c	2002-11-28 18:50:19.000000000 +0000
***************
*** 1464,1471 ****
  			  if ((i > 1) && (isdigit(s[i - 2])))
  			    {
  			      ptr[a++] = ((atoi(s)) * 255) / scale;
! 			      ptr[a++] = ptr[a - 1];
! 			      ptr[a++] = ptr[a - 1];
  			    }
  			  i = 0;
  			}
--- 1464,1473 ----
  			  if ((i > 1) && (isdigit(s[i - 2])))
  			    {
  			      ptr[a++] = ((atoi(s)) * 255) / scale;
! 			      ptr[a] = ptr[a - 1];
! 				a++;
! 			      ptr[a] = ptr[a - 1];
! 				a++;
  			    }
  			  i = 0;
  			}
***************
*** 1482,1489 ****
  			  if ((i > 1) && (isdigit(s[i - 2])))
  			    {
  			      ptr[a++] = atoi(s);
! 			      ptr[a++] = ptr[a - 1];
! 			      ptr[a++] = ptr[a - 1];
  			    }
  			  i = 0;
  			}
--- 1484,1493 ----
  			  if ((i > 1) && (isdigit(s[i - 2])))
  			    {
  			      ptr[a++] = atoi(s);
! 			      ptr[a] = ptr[a - 1];
! 				++a;
! 			      ptr[a] = ptr[a - 1];
! 				++a;
  			    }
  			  i = 0;
  			}


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


How reproducible:


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


Expected results:


Additional info:

Comment 1 Jonathan Blandford 2003-02-08 05:39:48 UTC
Filed upstream as http://bugzilla.gnome.org/show_bug.cgi?id=105558
Maintainer said he'd get to it in a later release.


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