[Bug analyzer/98073] New: error: in can_merge_p, at analyzer/region-model.cc

2020-11-30 Thread rnsanchez at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98073

Bug ID: 98073
   Summary: error: in can_merge_p, at analyzer/region-model.cc
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: rnsanchez at gmail dot com
  Target Milestone: ---

Created attachment 49655
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49655=edit
Manually reduced after preprocessing http_htx.c

While compiling HAProxy from git (@v2.4-dev1-42-g4d6c59499).

Compiling the reduced file:

$ cc -Iinclude -fanalyzer -Wno-address-of-packed-member   -DUSE_EPOLL 
-DUSE_NETFILTER -DUSE_PCRE-DUSE_POLL  -DUSE_THREAD  -DUSE_BACKTRACE  
-DUSE_TPROXY -DUSE_LINUX_TPROXY -DUSE_LINUX_SPLICE -DUSE_LIBCRYPT -DUSE_CRYPT_H
-DUSE_GETADDRINFO -DUSE_OPENSSL -DUSE_LUA -DUSE_FUTEX -DUSE_ACCEPT4  -DUSE_ZLIB
 -DUSE_CPU_AFFINITY -DUSE_TFO -DUSE_NS -DUSE_DL -DUSE_RT  -DUSE_PRCTL
-DUSE_THREAD_DUMP -DUSE_PCRE -I/usr/include 
-DCONFIG_HAPROXY_VERSION=\"2.4-dev1-4d6c59-42\"
-DCONFIG_HAPROXY_DATE=\"2020/11/30\" -c -o src/http_htx.o
src/http_htx-reduced.i -v -save-temps
Reading specs from /usr/lib64/gcc/x86_64-slackware-linux/10.2.0/specs
COLLECT_GCC=cc
Target: x86_64-slackware-linux
Configured with: ../configure --prefix=/usr --libdir=/usr/lib64
--mandir=/usr/man --infodir=/usr/info --enable-shared --enable-bootstrap
--enable-languages=ada,brig,c,c++,d,fortran,go,lto,objc,obj-c++
--enable-threads=posix --enable-checking=release --enable-objc-gc
--with-system-zlib --enable-libstdcxx-dual-abi --with-default-libstdcxx-abi=new
--disable-libstdcxx-pch --disable-libunwind-exceptions --enable-__cxa_atexit
--disable-libssp --enable-gnu-unique-object --enable-plugin --enable-lto
--disable-install-libiberty --disable-werror --with-gnu-ld --with-isl --verbose
--with-arch-directory=amd64 --disable-gtktest --enable-clocale=gnu
--disable-multilib --target=x86_64-slackware-linux
--build=x86_64-slackware-linux --host=x86_64-slackware-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-I' 'include' '-fanalyzer' '-Wno-address-of-packed-member'
'-D' 'USE_EPOLL' '-D' 'USE_NETFILTER' '-D' 'USE_PCRE' '-D' 'USE_POLL' '-D'
'USE_THREAD' '-D' 'USE_BACKTRACE' '-D' 'USE_TPROXY' '-D' 'USE_LINUX_TPROXY'
'-D' 'USE_LINUX_SPLICE' '-D' 'USE_LIBCRYPT' '-D' 'USE_CRYPT_H' '-D'
'USE_GETADDRINFO' '-D' 'USE_OPENSSL' '-D' 'USE_LUA' '-D' 'USE_FUTEX' '-D'
'USE_ACCEPT4' '-D' 'USE_ZLIB' '-D' 'USE_CPU_AFFINITY' '-D' 'USE_TFO' '-D'
'USE_NS' '-D' 'USE_DL' '-D' 'USE_RT' '-D' 'USE_PRCTL' '-D' 'USE_THREAD_DUMP'
'-D' 'USE_PCRE' '-I' '/usr/include' '-D'
'CONFIG_HAPROXY_VERSION="2.4-dev1-4d6c59-42"' '-D'
'CONFIG_HAPROXY_DATE="2020/11/30"' '-c' '-o' 'src/http_htx.o' '-v'
'-save-temps' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-slackware-linux/10.2.0/cc1 -fpreprocessed
src/http_htx-reduced.i -quiet -dumpbase http_htx-reduced.i -mtune=generic
-march=x86-64 -auxbase-strip src/http_htx.o -Wno-address-of-packed-member
-version -fanalyzer -o http_htx-reduced.s
GNU C17 (GCC) version 10.2.0 (x86_64-slackware-linux)
compiled by GNU C version 10.2.0, GMP version 6.2.0, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.23-GMP

warning: GMP header version 6.2.0 differs from library version 6.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C17 (GCC) version 10.2.0 (x86_64-slackware-linux)
compiled by GNU C version 10.2.0, GMP version 6.2.0, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.23-GMP

warning: GMP header version 6.2.0 differs from library version 6.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 7ecb224e89d32d55be91bf0fce5dc194
during IPA pass: analyzer
src/http_htx-reduced.i: In function 'http_update_host':
src/http_htx-reduced.i:123:14: internal compiler error: in can_merge_p, at
analyzer/region-model.cc:2053
  123 |authority = uri;
  |~~^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c/65446] Improve -Wformat-signedness

2016-06-09 Thread rnsanchez at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65446

Ricardo Nabinger Sanchez  changed:

   What|Removed |Added

 CC||rnsanchez at gmail dot com

--- Comment #5 from Ricardo Nabinger Sanchez  ---
Created attachment 38666
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38666=edit
Simple test case

I understand the reasoning behind the implicit promotions.

Here is my rationale, asking for the warning to be emitted nonetheless: suppose
the first test in the test case I supplied is used in code that emits assembly
for an assembler.  If the programmer mistakenly used %hu for a int16 type, and
that happened to generate a jump address, the implicit promotion would silently
hide an important error (possibly jumping to the opposite direction).  The
printed-out value is clearly incorrect.  It's not a compiler fault, but it just
so happens that the compiler is in the best position to warn the user that s/he
might run into problems.  Let the programmer decide whether this should be
looked into (fixing his/her code) or if s/he will ignore.

In my case, I noticed this issue (silent signedess-mismatch) because I was
getting negative ports (IPv4/IPv6) on someone else's code, which was only a
visual nuisance.  It would have been caught with the warning, but there was no
way I could get one.  Clang failed to generate such a warning as well (and in
fact produces the same output).

The same happens with %hhd/%hhu specifiers when given mismatching
uint8_t/int8_t.

In short: please warn.  Some cases will generate unexpected results (which are
not compilation errors), simply because the programmer used an incorrect format
specifier.