mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Fix likely-harmless undefined behavior surrounding volatile
The code was making two unsequenced reads from volatile locations. This is undefined behavior. It was probably harmless because we didn't care in what order the reads happened and the reads were from ordinary memory, but UB is UB and IAR8 complained.
This commit is contained in:
		
							parent
							
								
									695a34654a
								
							
						
					
					
						commit
						9b430704d1
					
				@ -1460,7 +1460,11 @@ static void mem_move_to_left( void *start,
 | 
			
		||||
         * `offset` passes shift the data one byte to the left and
 | 
			
		||||
         * zero out the last byte. */
 | 
			
		||||
        for( n = 0; n < total - 1; n++ )
 | 
			
		||||
            buf[n] = if_int( no_op, buf[n], buf[n+1] );
 | 
			
		||||
        {
 | 
			
		||||
            unsigned char current = buf[n];
 | 
			
		||||
            unsigned char next = buf[n+1];
 | 
			
		||||
            buf[n] = if_int( no_op, current, next );
 | 
			
		||||
        }
 | 
			
		||||
        buf[total-1] = if_int( no_op, buf[total-1], 0 );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user