[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#903771: marked as done (c99: buggy POSIX abs(INT_MIN))



Your message dated Thu, 19 Jul 2018 15:00:36 +0200
with message-id <20180719130036.GA22959@cventin.lip.ens-lyon.fr>
and subject line Re: c99: buggy POSIX abs(INT_MIN)
has caused the Debian Bug report #903771,
regarding c99: buggy POSIX abs(INT_MIN)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
903771: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=903771
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: gcc
Version: 4:7.3.0-3
Severity: normal

In the new POSIX abs() specification:

  If the result cannot be represented, the result shall be {INT_MIN}.

instead of being undefined behavior. See:

  http://austingroupbugs.net/view.php?id=1108#c4041

Thus the following program

----------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int main (void)
{
  volatile int i = INT_MIN;
  int j;

  j = abs (i);
  printf ("%d %d\n", j, j >= 0);
  return 0;
}
----------------------------------------

should output -2147483648 0 when compiled with the c99 utility. But:

zira:~> c99 -O2 -o tst tst.c
zira:~> ./tst
-2147483648 1

-- System Information:
Debian Release: buster/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 4.16.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=POSIX (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gcc depends on:
ii  cpp    4:7.3.0-3
ii  gcc-7  7.3.0-25

Versions of packages gcc recommends:
ii  libc6-dev [libc-dev]  2.27-4

Versions of packages gcc suggests:
ii  autoconf      2.69-11+local1
ii  automake      1:1.15.1-3.1
ii  bison         2:3.0.4.dfsg-1+b1
pn  flex          <none>
ii  gcc-doc       5:7.2.0-2
ii  gcc-multilib  4:7.3.0-3
ii  gdb           7.12-6+b2
ii  libtool       2.4.6-2.1+local1
ii  make          4.2.1-1.1
ii  manpages-dev  4.16-1

-- no debconf information

--- End Message ---
--- Begin Message ---
On 2018-07-14 17:19:09 +0200, Vincent Lefevre wrote:
> In the new POSIX abs() specification:
> 
>   If the result cannot be represented, the result shall be {INT_MIN}.
> 
> instead of being undefined behavior. See:
> 
>   http://austingroupbugs.net/view.php?id=1108#c4041

Closing the bug for now since this is for the next issue only,
and the utility name for compiling is not known yet.

There's also some hope that this change in POSIX will be reverted.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

--- End Message ---

Reply to: