https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112658
Bug ID: 112658 Summary: ICE: finish_expr_stmt , at cp/semantics.cc:892 Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: julia.desmazes at gmail dot com Target Milestone: --- Created attachment 56664 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56664&action=edit preprocessed file ( ii ) Hello, I have come across an internal compiler error when using g++ 13.2.1. The error occurs when casting a temporary array into a pointer and forwarding the result to a constructor. Code to reproduce : ``` #include <stdint.h> #include <iostream> #include <cstring> #define DEFAULT_DST_MAC ((uint8_t[6]) { 0xFC, 0xFC, 0x48, 0, 0, 0}) class foo{ public: foo(const uint8_t new_mac[6]){ std::cout << new_mac << std::endl; memcpy(&this->mac, new_mac, 6); } private: uint8_t mac[6]; }; int main(){ foo f((uint8_t*)DEFAULT_DST_MAC); return 0; } ``` Console log for `g++ -v -c main.cpp -freport-bug -save-temps` : ``` Using built-in specs. COLLECT_GCC=g++ Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --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 13.2.1 20230801 (GCC) COLLECT_GCC_OPTIONS='-v' '-c' '-freport-bug' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1plus -E -quiet -v -D_GNU_SOURCE main.cpp -mtune=generic -march=x86-64 -freport-bug -fpch-preprocess -o main.ii ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1 /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/x86_64-pc-linux-gnu /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/backward /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-c' '-freport-bug' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -freport-bug -o main.s GNU C++17 (GCC) version 13.2.1 20230801 (x86_64-pc-linux-gnu) compiled by GNU C version 13.2.1 20230801, GMP version 6.3.0, MPFR version 4.2.0-p12, MPC version 1.3.1, isl version isl-0.26-GMP warning: MPFR header version 4.2.0-p12 differs from library version 4.2.1. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 5a490a353c29b926850bca65a518c219 main.cpp: In function ‘int main()’: main.cpp:18:68: internal compiler error: in finish_expr_stmt, at cp/semantics.cc:892 18 | foo f((uint8_t*)DEFAULT_DST_MAC); | ^ 0x1ad33c8 internal_error(char const*, ...) ???:0 0x6b7b63 fancy_abort(char const*, int, char const*) ???:0 0x76527f cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ???:0 0x9443d0 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source. Please include the complete backtrace with any bug report. See <https://bugs.archlinux.org/> for instructions. Preprocessed source stored into /tmp/ccJZigsM.out file, please attach this to your bugreport. make: *** [makefile:10: main.o] Error 1 ``` If needed, the `ccJZigsM.out` file can be found in the following git : https://github.com/Essenceia/gcc_bug I will be happy to provide any additional files if needed. Regards, Julia Desmazes