Bug 79643 - bad source code
bad source code
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: SDL_mixer (Show other bugs)
8.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Thomas Woerner
:
: 110821 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-12-14 05:50 EST by d.binderman
Modified: 2007-04-18 12:49 EDT (History)
0 users

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


Attachments (Terms of Use)

  None (edit)
Description d.binderman 2002-12-14 05:50:49 EST
Description of problem:

Hello there,

I just tried to compile package SDL_mixer-1.2.4-5 from Redhat 8.0.

Here are some of the compiler messages.

effect_position.c:102: warning: operation on `ptr' may be undefined
effect_position.c:107: warning: operation on `ptr' may be undefined
effect_position.c:108: warning: operation on `ptr' may be undefined
effect_position.c:137: warning: operation on `ptr' may be undefined
effect_position.c:139: warning: operation on `ptr' may be undefined
effect_position.c:155: warning: operation on `p' may be undefined
effect_position.c:155: warning: operation on `p' may be undefined
effect_position.c:155: warning: operation on `p' may be undefined
effect_position.c:155: warning: operation on `p' may be undefined
effect_position.c:173: warning: operation on `ptr' may be undefined
effect_position.c:178: warning: operation on `ptr' may be undefined
effect_position.c:179: warning: operation on `ptr' may be undefined
effect_position.c:204: warning: operation on `ptr' may be undefined
effect_position.c:206: warning: operation on `ptr' may be undefined
effect_position.c:222: warning: operation on `p' may be undefined
effect_position.c:222: warning: operation on `p' may be undefined
effect_position.c:222: warning: operation on `p' may be undefined
effect_position.c:222: warning: operation on `p' may be undefined
effect_position.c:247: warning: operation on `ptr' may be undefined
effect_position.c:248: warning: operation on `ptr' may be undefined
effect_position.c:269: warning: operation on `ptr' may be undefined
effect_position.c:270: warning: operation on `ptr' may be undefined

Here is a patch which shuts up the compiler.

*** ./effect_position.c.old	2002-11-28 08:47:32.000000000 +0000
--- ./effect_position.c	2002-11-28 08:54:08.000000000 +0000
***************
*** 99,111 ****
           *  1.0, and are therefore throwaways.
           */
      if (len % sizeof (Uint16) != 0) {
!         *(ptr++) = (Uint8) (((float) *ptr) * args->distance_f);
          len--;
      }
  
      for (i = 0; i < len; i += sizeof (Uint8) * 2) {
!         *(ptr++) = (Uint8)((((float) *ptr) * args->left_f) * args->distance_f);
!         *(ptr++) = (Uint8)((((float) *ptr) * args->right_f) * args->distance_f);
      }
  }
  
--- 99,114 ----
           *  1.0, and are therefore throwaways.
           */
      if (len % sizeof (Uint16) != 0) {
!         *ptr = (Uint8) (((float) *ptr) * args->distance_f);
! 	ptr++;
          len--;
      }
  
      for (i = 0; i < len; i += sizeof (Uint8) * 2) {
!         *ptr = (Uint8)((((float) *ptr) * args->left_f) * args->distance_f);
! 	ptr++;
!         *ptr = (Uint8)((((float) *ptr) * args->right_f) * args->distance_f);
! 	ptr++;
      }
  }
  
***************
*** 134,142 ****
           *  be sure not to overrun the audio buffer...
           */
      while (len % sizeof (Uint32) != 0) {
!         *(ptr++) = d[l[*ptr]];
          if (args->channels == 2)
!             *(ptr++) = d[r[*ptr]];
          len -= args->channels;
      }
  
--- 137,149 ----
           *  be sure not to overrun the audio buffer...
           */
      while (len % sizeof (Uint32) != 0) {
!         *ptr = d[l[*ptr]];
! 	ptr++;
          if (args->channels == 2)
! 	{
!             *ptr = d[r[*ptr]];
! 	    ptr++;
! 	}
          len -= args->channels;
      }
  
***************
*** 144,158 ****
  
      for (i = 0; i < len; i += sizeof (Uint32)) {
  #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
!         *(p++) = (d[l[(*p & 0xFF000000) >> 24]] << 24) |
                   (d[r[(*p & 0x00FF0000) >> 16]] << 16) |
                   (d[l[(*p & 0x0000FF00) >>  8]] <<  8) |
                   (d[r[(*p & 0x000000FF)      ]]      ) ;
  #else
!         *(p++) = (d[r[(*p & 0xFF000000) >> 24]] << 24) |
                   (d[l[(*p & 0x00FF0000) >> 16]] << 16) |
                   (d[r[(*p & 0x0000FF00) >>  8]] <<  8) |
                   (d[l[(*p & 0x000000FF)      ]]      ) ;
  #endif
      }
  }
--- 151,167 ----
  
      for (i = 0; i < len; i += sizeof (Uint32)) {
  #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
!         *p = (d[l[(*p & 0xFF000000) >> 24]] << 24) |
                   (d[r[(*p & 0x00FF0000) >> 16]] << 16) |
                   (d[l[(*p & 0x0000FF00) >>  8]] <<  8) |
                   (d[r[(*p & 0x000000FF)      ]]      ) ;
+ 	p++;
  #else
!         *p = (d[r[(*p & 0xFF000000) >> 24]] << 24) |
                   (d[l[(*p & 0x00FF0000) >> 16]] << 16) |
                   (d[r[(*p & 0x0000FF00) >>  8]] <<  8) |
                   (d[l[(*p & 0x000000FF)      ]]      ) ;
+ 	p++;
  #endif
      }
  }
***************
*** 170,182 ****
           *  1.0, and are therefore throwaways.
           */
      if (len % sizeof (Sint16) != 0) {
!         *(ptr++) = (Sint8) (((float) *ptr) * args->distance_f);
          len--;
      }
  
      for (i = 0; i < len; i += sizeof (Sint8) * 2) {
!         *(ptr++) = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f);
!         *(ptr++) = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f);
      }
  }
  
--- 179,194 ----
           *  1.0, and are therefore throwaways.
           */
      if (len % sizeof (Sint16) != 0) {
!         *ptr = (Sint8) (((float) *ptr) * args->distance_f);
! 	ptr++;
          len--;
      }
  
      for (i = 0; i < len; i += sizeof (Sint8) * 2) {
!         *ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f);
! 	ptr++;
!         *ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f);
! 	ptr++;
      }
  }
  
***************
*** 201,209 ****
  
  
      while (len % sizeof (Uint32) != 0) {
!         *(ptr++) = d[l[*ptr]];
          if (args->channels > 1)
!             *(ptr++) = d[r[*ptr]];
          len -= args->channels;
      }
  
--- 213,225 ----
  
  
      while (len % sizeof (Uint32) != 0) {
!         *ptr = d[l[*ptr]];
! 	ptr++;
          if (args->channels > 1)
! 	{
!             *ptr = d[r[*ptr]];
! 	    ptr++;
! 	}
          len -= args->channels;
      }
  
***************
*** 211,225 ****
  
      for (i = 0; i < len; i += sizeof (Uint32)) {
  #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
!         *(p++) = (d[l[((Sint16)(Sint8)((*p & 0xFF000000) >> 24))+128]] << 24) |
                   (d[r[((Sint16)(Sint8)((*p & 0x00FF0000) >> 16))+128]] << 16) |
                   (d[l[((Sint16)(Sint8)((*p & 0x0000FF00) >>  8))+128]] <<  8) |
                   (d[r[((Sint16)(Sint8)((*p & 0x000000FF)      ))+128]]      ) ;
  #else
!         *(p++) = (d[r[((Sint16)(Sint8)((*p & 0xFF000000) >> 24))+128]] << 24) |
                   (d[l[((Sint16)(Sint8)((*p & 0x00FF0000) >> 16))+128]] << 16) |
                   (d[r[((Sint16)(Sint8)((*p & 0x0000FF00) >>  8))+128]] <<  8) |
                   (d[l[((Sint16)(Sint8)((*p & 0x000000FF)      ))+128]]      ) ;
  #endif
      }
  
--- 227,243 ----
  
      for (i = 0; i < len; i += sizeof (Uint32)) {
  #if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
!         *p = (d[l[((Sint16)(Sint8)((*p & 0xFF000000) >> 24))+128]] << 24) |
                   (d[r[((Sint16)(Sint8)((*p & 0x00FF0000) >> 16))+128]] << 16) |
                   (d[l[((Sint16)(Sint8)((*p & 0x0000FF00) >>  8))+128]] <<  8) |
                   (d[r[((Sint16)(Sint8)((*p & 0x000000FF)      ))+128]]      ) ;
+ 	p++;
  #else
!         *p = (d[r[((Sint16)(Sint8)((*p & 0xFF000000) >> 24))+128]] << 24) |
                   (d[l[((Sint16)(Sint8)((*p & 0x00FF0000) >> 16))+128]] << 16) |
                   (d[r[((Sint16)(Sint8)((*p & 0x0000FF00) >>  8))+128]] <<  8) |
                   (d[l[((Sint16)(Sint8)((*p & 0x000000FF)      ))+128]]      ) ;
+ 	p++;
  #endif
      }
  
***************
*** 244,251 ****
          *(ptr++) = (Uint16) SDL_Swap16(swapl);
          *(ptr++) = (Uint16) SDL_Swap16(swapr);
  #else
!         *(ptr++) = (Uint16) ((((float) *ptr)*args->left_f)*args->distance_f);
!         *(ptr++) = (Uint16) ((((float) *ptr)*args->right_f)*args->distance_f);
  #endif
      }
  }
--- 262,271 ----
          *(ptr++) = (Uint16) SDL_Swap16(swapl);
          *(ptr++) = (Uint16) SDL_Swap16(swapr);
  #else
!         *ptr = (Uint16) ((((float) *ptr)*args->left_f)*args->distance_f);
! 	ptr++;
!         *ptr = (Uint16) ((((float) *ptr)*args->right_f)*args->distance_f);
! 	ptr++;
  #endif
      }
  }
***************
*** 266,273 ****
          *(ptr++) = (Sint16) SDL_Swap16(swapl);
          *(ptr++) = (Sint16) SDL_Swap16(swapr);
  #else
!         *(ptr++) = (Sint16) ((((float) *ptr)*args->left_f)*args->distance_f);
!         *(ptr++) = (Sint16) ((((float) *ptr)*args->right_f)*args->distance_f);
  #endif
      }
  }
--- 286,295 ----
          *(ptr++) = (Sint16) SDL_Swap16(swapl);
          *(ptr++) = (Sint16) SDL_Swap16(swapr);
  #else
!         *ptr = (Sint16) ((((float) *ptr)*args->left_f)*args->distance_f);
! 	ptr++;
!         *ptr = (Sint16) ((((float) *ptr)*args->right_f)*args->distance_f);
! 	ptr++;
  #endif
      }
  }


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


How reproducible:


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


Expected results:


Additional info:
Comment 1 Thomas Woerner 2004-04-22 08:07:21 EDT
Fixed in rawhide in rpm SDL_mixer-1.2.5-2 or newer.
Comment 2 Thomas Woerner 2004-04-22 08:11:32 EDT
*** Bug 110821 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.