Your message dated Fri, 24 Dec 2021 18:05:24 +0100
with message-id <[email protected]>
and subject line close: upstream bugs or too old
has caused the Debian Bug report #808861,
regarding clang: Recommends bad format specifier for USHRT_MAX constant
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 [email protected]
immediately.)


-- 
808861: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808861
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: clang
Version: 1:3.6-32
Severity: minor

Dear Maintainer,

Consider the following program:

```
#include <limits.h>
#include <stdio.h>

int
main (void)
{
  printf ("%hu\n", USHRT_MAX);
  return 0;
}
```

If I compile this with clang (tested with -std=c11 but might be present
with other standards), I will get a warning about using the %hu format
specifier, since the definition of USHRT_MAX is identified as an int
(from a quick check of the header file, it uses arithmetic to determine it).

However, the minimum size of an int is 16 bits, as is an unsigned short.
That being the case, using a %d specifier as the warning recommends
could cause bad output. If both int and unsigned short are of the same
length on an implementation, then that format specifier would read an
unsigned 16-bit integer value as a signed 16-bit integer value,
resulting in incorrect output.

On implementations like mine where int is 32 bits wide, this wouldn't be
harmful, but the standard says that this could technically be a problem.

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.3.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages clang depends on:
ii  clang-3.6  1:3.6.2-3

clang recommends no packages.

clang suggests no packages.

-- no debconf information


Happy Hacking,

David E. McMackins II
Associate, Free Software Foundation (#12889)

www.mcmackins.org www.delwink.com
www.gnu.org www.fsf.org

--- End Message ---
--- Begin Message ---
X-CrossAssassin-Score: 31962

--- End Message ---

Reply via email to