https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83814
Sunil Pandey <skpgkp1 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |skpgkp1 at gmail dot com --- Comment #6 from Sunil Pandey <skpgkp1 at gmail dot com> --- I'm getting similar issue with mariadb build. Here is test case. $ cat cert_wrapper.i.cpp extern "C" void *memset(void *, int, unsigned long); unsigned a; template <class> void b() { int c; memset((char *)c + a, 0, a); } $g++ --version g++ (GCC) 8.0.0 20180111 (experimental) Copyright (C) 2018 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. $g++ -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fno-rtti -O3 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -fPIC -fvisibility=hidden -o cert_wrapper.i.cpp.o -c cert_wrapper.i.cpp cert_wrapper.i.cpp: In function ‘void b()’: cert_wrapper.i.cpp:5:29: internal compiler error: in fold_binary_loc, at fold-const.c:9733 memset((char *)c + a, 0, a); ^ 0x6a5bce fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*) ../../gcc-main.3UZ3/gcc/fold-const.c:9733 0xcc11ec fold(tree_node*) ../../gcc-main.3UZ3/gcc/fold-const.c:11957 0x935265 cp_fold ../../gcc-main.3UZ3/gcc/cp/cp-gimplify.c:2279 0x935e0c cp_fold_maybe_rvalue ../../gcc-main.3UZ3/gcc/cp/cp-gimplify.c:2005 0xb27fb9 warn_for_memset(unsigned int, tree_node*, tree_node*, int) ../../gcc-main.3UZ3/gcc/c-family/c-warn.c:1871 0x9fa898 cp_parser_postfix_expression ../../gcc-main.3UZ3/gcc/cp/parser.c:7182 0x9fae70 cp_parser_unary_expression ../../gcc-main.3UZ3/gcc/cp/parser.c:8281 0x9dc7ef cp_parser_cast_expression ../../gcc-main.3UZ3/gcc/cp/parser.c:9049 0x9dcffa cp_parser_binary_expression ../../gcc-main.3UZ3/gcc/cp/parser.c:9150 0x9de7c4 cp_parser_assignment_expression ../../gcc-main.3UZ3/gcc/cp/parser.c:9437 0x9deeda cp_parser_expression ../../gcc-main.3UZ3/gcc/cp/parser.c:9606 0x9e0ba8 cp_parser_expression_statement ../../gcc-main.3UZ3/gcc/cp/parser.c:11063 0x9e5a8d cp_parser_statement ../../gcc-main.3UZ3/gcc/cp/parser.c:10879 0x9e7020 cp_parser_statement_seq_opt ../../gcc-main.3UZ3/gcc/cp/parser.c:11206 0x9e70f7 cp_parser_compound_statement ../../gcc-main.3UZ3/gcc/cp/parser.c:11160 0x9fd6f0 cp_parser_function_body ../../gcc-main.3UZ3/gcc/cp/parser.c:21700 0x9fd6f0 cp_parser_ctor_initializer_opt_and_function_body ../../gcc-main.3UZ3/gcc/cp/parser.c:21737 0x9fdfb0 cp_parser_function_definition_after_declarator ../../gcc-main.3UZ3/gcc/cp/parser.c:26635 0x9fec9b cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-main.3UZ3/gcc/cp/parser.c:26551 0x9fec9b cp_parser_init_declarator ../../gcc-main.3UZ3/gcc/cp/parser.c:19426 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Work fine with previous day compiler. $g++ --version g++ (GCC) 8.0.0 20180110 (experimental) Copyright (C) 2018 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. $g++ -pie -fPIC -Wl,-z,relro,-z,now -fstack-protector --param=ssp-buffer-size=4 -fno-rtti -O3 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -fPIC -fvisibility=hidden -o cert_wrapper.i.cpp.o -c cert_wrapper.i.cpp $echo $? 0