[Bug c++/115600] UndefinedBehaviorSanitizer doesn't seem to like modules

2024-06-23 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115600

--- Comment #2 from Christopher Di Bella  ---
I forgot that `gcc -v` can provide config options.

```
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/14.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust
--enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.1.1 20240522 (GCC)
```

[Bug c++/115600] New: UndefinedBehaviorSanitizer doesn't seem to like modules

2024-06-23 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115600

Bug ID: 115600
   Summary: UndefinedBehaviorSanitizer doesn't seem to like
modules
   Product: gcc
   Version: 14.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

Created attachment 58498
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58498&action=edit
Preprocessed source

## GCC info

```
$ gcc --version
gcc (GCC) 14.1.1 20240522
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

## System type

```
$ lsb_release -a
LSB Version:n/a
Distributor ID: Arch
Description:Arch Linux
Release:rolling
Codename:   n/a
```

## How GCC was configured/built

Arch default

## Command line

Original invocation

```
/usr/bin/g++   -fdiagnostics-color=always -fstack-protector-strong
-fvisibility=hidden -Werror -pedantic -Wall -Wattributes -Wcast-align
-Wconversion -Wdouble-promotion -Wextra -Wformat=2 -Wnon-virtual-dtor
-Wnull-dereference -Wodr -Wold-style-cast -Woverloaded-virtual -Wshadow
-Wsign-conversion -Wsign-promo -Wunused -Wno-ignored-attributes
-Wno-cxx-attribute-extension -Wno-gnu-include-next -Wno-private-header
-Wno-unused-command-line-argument -D_GLIBCXX_ASSERTIONS
-fsanitize=address,undefined -g -std=gnu++23 -MD -MT
source/module_interface/CMakeFiles/greeter_module.dir/greeter_module.cpp.o -MF
source/module_interface/CMakeFiles/greeter_module.dir/greeter_module.cpp.o.d
-fmodules-ts
-fmodule-mapper=source/module_interface/CMakeFiles/greeter_module.dir/greeter_module.cpp.o.modmap
-MD -fdeps-format=p1689r5 -x c++ -o
source/module_interface/CMakeFiles/greeter_module.dir/greeter_module.cpp.o -c
~/projects/project-template-3/build/test/default-options/Output/gnu-toolchain.test.tmp/gnu_toolchain/source/module_interface/greeter_module.cpp
```

With some experimenting, I was able to minimise it to this. Note that the
culprit is `-fsanitize=undefined`: it'll work fine without that (and with
`-fsanitize=address`).

```
/usr/bin/g++ -fsanitize=undefined -std=gnu++23 -fmodules-ts
-fmodule-mapper=source/module_interface/CMakeFiles/greeter_module.dir/greeter_module.cpp.o.modmap
-MD -fdeps-format=p1689r5 -x c++ ~/projects/pr
oject-template-3/build/test/default-options/Output/gnu-toolchain.test.tmp/gnu_toolchain/source/module_interface/greeter_module.cpp
```

## Diagnostic

```
internal compiler error: in tree_node, at cp/module.cc:9428
4 | export module greeter;
  |^~
0x217b27a internal_error(char const*, ...)
???:0
0x703e87 fancy_abort(char const*, int, char const*)
???:0
0x8237da depset::hash::find_dependencies(module_state*)
???:0
0x829996 module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
???:0
0x839c57 finish_module_processing(cpp_reader*)
???:0
0x7ccdfd c_parse_final_cleanups()
???:0
0x9c4fb2 c_common_parse_file()
???:0
```

[Bug libstdc++/113283] missing C++26 freestanding headers.

2024-01-09 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113283

Christopher Di Bella  changed:

   What|Removed |Added

 CC||cjdb.ns at gmail dot com

--- Comment #8 from Christopher Di Bella  ---
I briefly suggested moving `` into Clang like `` is, but
nothing concrete was ever put into place. As it stands, I do not expect this to
be actioned.

For folks who are interested in what LLVM folks have discussed, please see the
relevant [GitHub issue](https://github.com/llvm/llvm-project/issues/77373).

[Bug c++/109337] c++2a test concepts4.C passes when it should fail

2023-03-29 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337

--- Comment #3 from Christopher Di Bella  ---
This is apparently a Clang bug: the RHS of `R42c` isn't evaluated because of
short-circuiting. Apologies for the noise and thanks for helping me work
through it.

[Bug c++/109338] New: `S auto>` isn't valid C++20

2023-03-29 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109338

Bug ID: 109338
   Summary: `S auto>` isn't valid C++20
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

Clang and GCC disagree on whether or not this code is valid. This **may** be a
relic from the Concepts TS, which Clang doesn't implement.

https://godbolt.org/z/c7rGWE9s6

[Bug c++/109337] New: c++2a test concepts4.C passes when it should fail

2023-03-29 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337

Bug ID: 109337
   Summary: c++2a test concepts4.C passes when it should fail
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

Clang and GCC disagree on the validity of concepts4.C. I think Clang is correct
here, because forming a reference to `void` should be ill-formed.

https://godbolt.org/z/es5GxYhzd

[Bug c++/92505] Using mutable in constexpr

2021-07-12 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92505

Christopher Di Bella  changed:

   What|Removed |Added

 CC||cjdb.ns at gmail dot com

--- Comment #3 from Christopher Di Bella  ---
Gentle ping, this has started to cause issues in the libc++ GCC CI for ranges.

[Bug c++/99701] New: std::nullptr_t can be compared with relational ops

2021-03-21 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99701

Bug ID: 99701
   Summary: std::nullptr_t can be compared with relational ops
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

Created attachment 50443
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50443&action=edit
Temp file for provided source

The following program is valid in all versions of GCC from 4.7.1 through
trunk[1]. Relational operations on std::nullptr_t don't really make sense since
there's only one value.

```
auto lt = nullptr < nullptr;
auto gt = nullptr > nullptr;
auto le = nullptr <= nullptr;
auto ge = nullptr >= nullptr;
```

This was apparently addressed by DR583/N3478 (thanks to Richard Smith for
providing these).

[1]: https://godbolt.org/z/h11183

# Versions

* All GCC releases at least as far back as 4.7.1 (where I stopped looking).

# System type

* Debian (checked GCC 10.2.1)
* Compiler Explorer (checked all other reported versions).

# Options given to GCC

`g++ -save-temps nullptr-relop.cpp -c -std=c++20`

[Bug c++/99374] New: C++17/20 mode fails to recognise pointer-to-member functions of incomplete types in conditional expression

2021-03-03 Thread cjdb.ns at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99374

Bug ID: 99374
   Summary: C++17/20 mode fails to recognise pointer-to-member
functions of incomplete types in conditional
expression
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

Created attachment 50296
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50296&action=edit
Failure with -std=c++17

GCC seems to be unable to handle pointer-to-member functions of incomplete
types in conditional expressions. The following works on both Clang and MSVC,
and some invocations of GCC.

```
struct S;
using F1 = int (S::*)();
using F2 = int (S::*)() noexcept;

auto v = true ? F1() : F2();
auto w = true ? F2() : F1();
```

This appears to work if `-std=c++14`, but not `-std=c++17` or `-std=c++20` for
GCC versions >= 7. GCC < 7 doesn't have a problem compiling even in C++17 mode.

# Versions

* All GCC releases from 7.1.0 through trunk.

# System type

* Ubuntu 18.04 (checked GCC 10.1)
* Ubuntu 20.04 on WSL2 (checked GCC 10.2)
* Debian (checked GCC 10.2.1)
* Compiler Explorer (checked all other reported versions).

# Options given to GCC

`g++ -save-temps fail-17.cpp -c -std=c++17`

# Diagnostic

```
fail-17.cpp:5:27: error: could not convert ‘((int (S::*)() noexcept)0)’ from
‘int (S::*)() noexcept’ to ‘int (S::*)()’
5 | auto v = true ? F1() : F2();
  |   ^
  |   |
  |   int (S::*)() noexcept
fail-17.cpp:6:27: error: could not convert ‘((int (S::*)() noexcept)0)’ from
‘int (S::*)() noexcept’ to ‘int (S::*)()’
6 | auto w = true ? F2() : F1();
  |   ^
  |   |
  |   int (S::*)() noexcept
```