[Bug preprocessor/106930] New: No __ILP32__ preprocessor macro defined on ARM (32bit)

2022-09-13 Thread stefan.bruens--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106930

Bug ID: 106930
   Summary: No __ILP32__ preprocessor macro defined on ARM (32bit)
   Product: gcc
   Version: 12.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: preprocessor
  Assignee: unassigned at gcc dot gnu.org
  Reporter: stefan.bru...@rwth-aachen.de
  Target Milestone: ---

For generic code, it is useful to have macros like __LP64__ and __ILP32__
everywhere.

On ix86 (32bit), __ILP32__ is defined, while on ARM (e.g. ARMv7) it is not.

IMHO __ILP32__ should be defined on *all* matching archs.

[Bug libstdc++/103848] [11/12 Regression] std::deque<>::iterator operator- uses "0" for nullptr check, triggers "zero-as-null-pointer-constant" warning

2022-01-04 Thread stefan.bruens--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103848

--- Comment #8 from Stefan BrĂ¼ns  ---
(In reply to Jonathan Wakely from comment #2)
> This is not a bug.
> 
> Firstly, there's no testcase provided (as https://gcc.gnu.org/bugs says is
> needed). Here's the missing testcase:
> 
> #include 
> std::deque d;
> auto n = d.begin() - d.begin();
> 
> Secondly, the command to reproduce the error is not provided, as the link
> also says is needed. This "error" only happens with
> -Werror=zero-as-null-pointer-constant -Wsystem-headers, so don't do that.
> This is not even a warning unless you explicitly ask for it (it's not in
> -Wall or -Wextra) and if you choose to make it an error, that's your fault.
> 
> We can't nullptr because the code needs to compile as C++98. We could use
> NULL or __null, or Jakub suggested just _Map_pointer. I find all of those
> inferior to 0 but I suppose we can change it.

Full GCC command line:

```
[  826s] g++ -c -o test_allheaders_allheaders.o 
-I/home/abuild/rpmbuild/BUILD/wxWidgets-3.1.5/lib/wx/include/gtk3-unicode-3.1
-I../include -D_FILE_OFFSET_BITS=64 -I/usr/include/gtk-3.0
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libmount
-I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/uuid
-I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0
-I/usr/include/wayland -I/usr/include/libxkbcommon -I/usr/include/atk-1.0
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0
-I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread  -D__WXGTK__  
   -I. -DWXUSINGDLL -I./../samples -I../3rdparty/catch/include -pthread -Wall
-Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual
-Wno-deprecated-declarations -I/usr/include/freetype2 -I/usr/include/uuid
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/harfbuzz -I/usr/include/libmount -I/usr/include/blkid
-I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1
-I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0
-I/usr/include/gio-unix-2.0 -I/usr/include/wayland -I/usr/include/libxkbcommon
-I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0
-I/usr/lib64/dbus-1.0/include -I/usr/include/at-spi-2.0 -I/usr/include/SDL2
-D_REENTRANT -O2 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type
-flto=auto -g -I/usr/include/webkitgtk-4.0 -I/usr/include/libsoup-2.4
-I/usr/include/libxml2 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 
-fvisibility=hidden -fvisibility-inlines-hidden -fPIC -DPIC  -O2 -Wall
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type
-flto=auto -g ./allheaders.cpp
[  826s] In file included from /usr/include/c++/11/deque:67,
[  826s]  from /usr/include/c++/11/queue:60,
[  826s]  from ../include/wx/msgqueue.h:24,
[  826s]  from ./allheaders.h:239,
[  826s]  from ./allheaders.cpp:435:
```

So definitely neither -Werror=zero-as-null-pointer-constant nor
-Wsystem-headers.


GCC -v
```
Using built-in specs.
Reading specs from /usr/lib64/gcc/x86_64-suse-linux/11/defaults.spec
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,ada,go,d,jit
--enable-offload-targets=nvptx-none,amdgcn-amdhsa, --without-cuda-driver
--enable-host-shared --enable-checking=release --disable-werror
--with-gxx-include-dir=/usr/include/c++/11 --enable-ssp --disable-libssp
--disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin
--with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new
--disable-libstdcxx-pch --enable-libphobos
--enable-version-specific-runtime-libs --with-gcc-major-version-only
--enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function
--program-suffix=-11 --without-system-libunwind --enable-multilib
--with-arch-32=x86-64 --with-tune=generic
--with-build-config=bootstrap-lto-lean --enable-link-mutex
--build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.1 20211124 [revision 7510c23c1ec53aa4a62705f0384079661342ff7b]
(SUSE Linux) 
```

[Bug libstdc++/103848] New: std::deque<>::operator- uses "0" for nullptr check, triggers "zero-as-null-pointer-constant"

2021-12-27 Thread stefan.bruens--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103848

Bug ID: 103848
   Summary: std::deque<>::operator- uses "0" for nullptr check,
triggers "zero-as-null-pointer-constant"
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: stefan.bru...@rwth-aachen.de
  Target Milestone: ---

Since
https://github.com/gcc-mirror/gcc/commit/f6be5d6ee31b76838e242704782938bc9745659c

using `operator-` may fail:

```
[  346s] In file included from /usr/include/c++/11/deque:67,
[  346s]  from /usr/include/c++/11/queue:60,
...
[  346s] /usr/include/c++/11/bits/stl_deque.h:356:58: error: zero as null
pointer constant [-Werror=zero-as-null-pointer-constant]
[  346s]   356 |   * (__x._M_node - __y._M_node - int(__x._M_node !=
0))
[  346s]   |  ^~~~
[  346s] cc1plus: some warnings being treated as errors
```