[Bug 1767493] Re: 64bit integer division broken on 32bit armhf

Matthias Klose doko at ubuntu.com
Wed Sep 12 14:29:31 UTC 2018


** Changed in: gcc-5 (Ubuntu)
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-5 in Ubuntu.
https://bugs.launchpad.net/bugs/1767493

Title:
  64bit integer division broken on 32bit armhf

Status in gcc-5 package in Ubuntu:
  Invalid
Status in valgrind package in Ubuntu:
  New

Bug description:
  Integer division for 64 bit integers is emulated on 32 bit devices.
  Unfortunately it does not work properly on armhf (see example below):

  Since this problem seems to be in libgcc_s.so.1 many programs are
  theoretically affected and may therefore crash. I have tested it with
  Ubuntu 16.04 on different devices with an ARMv7 SOC (e.g. Nano Pi Duo,
  OrangePi) .

  Output of valgrind --leak-check=yes ./test :
  --------------------------------------------

  ==7342== Memcheck, a memory error detector
  ==7342== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
  ==7342== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
  ==7342== Command: ./test
  ==7342== 
  ==7342== Invalid write of size 4
  ==7342==    at 0x4867B52: ??? (in /lib/arm-linux-gnueabihf/libgcc_s.so.1)
  ==7342==  Address 0xbdc10470 is on thread 1's stack
  ==7342==  16 bytes below stack pointer
  ==7342== 
  ==7342== Conditional jump or move depends on uninitialised value(s)
  ==7342==    at 0x48692FE: __udivmoddi4 (in /lib/arm-linux-gnueabihf/libgcc_s.so.1)
  ==7342== 
  ==7342== Use of uninitialised value of size 4
  ==7342==    at 0x4869300: __udivmoddi4 (in /lib/arm-linux-gnueabihf/libgcc_s.so.1)
  ==7342== 
  ==7342== Use of uninitialised value of size 4
  ==7342==    at 0x4867BA2: ??? (in /lib/arm-linux-gnueabihf/libgcc_s.so.1)
  ==7342== 
  ==7342== 
  ==7342== HEAP SUMMARY:
  ==7342==     in use at exit: 0 bytes in 0 blocks
  ==7342==   total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
  ==7342== 
  ==7342== All heap blocks were freed -- no leaks are possible
  ==7342== 
  ==7342== For counts of detected and suppressed errors, rerun with: -v
  ==7342== Use --track-origins=yes to see where uninitialised values come from
  ==7342== ERROR SUMMARY: 5 errors from 4 contexts (suppressed: 6 from 3)

  
  Code:
  -----

  #include <stdio.h>

  int main(){

  	signed long long int value1 = 999;
  	signed long long int value2 = -333;
  	value1 = value1 / value2;
  	
  	printf("value1: %lli\n", value1);

  	return 0;
  }

  
  lsb_release -rd :
  -----------------

  Description:	Ubuntu 16.04.4 LTS
  Release:	16.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1767493/+subscriptions



More information about the foundations-bugs mailing list