public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115600] New: UndefinedBehaviorSanitizer doesn't seem to like modules
@ 2024-06-23 17:27 cjdb.ns at gmail dot com
  2024-06-23 18:21 ` [Bug c++/115600] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cjdb.ns at gmail dot com @ 2024-06-23 17:27 UTC (permalink / raw)
  To: 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
```

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115600] UndefinedBehaviorSanitizer doesn't seem to like modules
  2024-06-23 17:27 [Bug c++/115600] New: UndefinedBehaviorSanitizer doesn't seem to like modules cjdb.ns at gmail dot com
@ 2024-06-23 18:21 ` pinskia at gcc dot gnu.org
  2024-06-23 18:23 ` cjdb.ns at gmail dot com
  2024-06-23 18:36 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-23 18:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115600

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-23
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reducing ...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115600] UndefinedBehaviorSanitizer doesn't seem to like modules
  2024-06-23 17:27 [Bug c++/115600] New: UndefinedBehaviorSanitizer doesn't seem to like modules cjdb.ns at gmail dot com
  2024-06-23 18:21 ` [Bug c++/115600] " pinskia at gcc dot gnu.org
@ 2024-06-23 18:23 ` cjdb.ns at gmail dot com
  2024-06-23 18:36 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cjdb.ns at gmail dot com @ 2024-06-23 18:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115600

--- Comment #2 from Christopher Di Bella <cjdb.ns at gmail dot com> ---
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)
```

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/115600] UndefinedBehaviorSanitizer doesn't seem to like modules
  2024-06-23 17:27 [Bug c++/115600] New: UndefinedBehaviorSanitizer doesn't seem to like modules cjdb.ns at gmail dot com
  2024-06-23 18:21 ` [Bug c++/115600] " pinskia at gcc dot gnu.org
  2024-06-23 18:23 ` cjdb.ns at gmail dot com
@ 2024-06-23 18:36 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-23 18:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115600

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 98735 ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-23 18:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-23 17:27 [Bug c++/115600] New: UndefinedBehaviorSanitizer doesn't seem to like modules cjdb.ns at gmail dot com
2024-06-23 18:21 ` [Bug c++/115600] " pinskia at gcc dot gnu.org
2024-06-23 18:23 ` cjdb.ns at gmail dot com
2024-06-23 18:36 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).