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

            Bug ID: 116320
           Summary: ICE: Segmentation fault
                    (perform_or_defer_access_check)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---
            Target: x86_64

*******************************************************************************
The compiler produces a segfault during perform_or_defer_access_check when
compiling the provided code with the specified options. 
The issue can also be reproduced on Compiler Explorer.

*******************************************************************************
OS and Platform:
# uname -a
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/gcc-set/gcc24-7-24/gccbin/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/gcc-set/gcc24-7-24/configure
--prefix=/home/gcc-set/gcc24-7-24/gccbin --enable-languages=c,c++,fortran,go
--disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240724 (experimental) (GCC) 
*******************************************************************************
Program: 
# cat 1.cpp
class   b{ };

template<class Type> class      c : public b{
    c<Type>*    A();
    static      c<Type>*        d;
};

template<class Type> c<Type>*   c<Type>::d;
template<class Type> c<Type>* c<Type>::A(){
    if  (d->b::State()) { } 
    return NULL;
}
*******************************************************************************
Command Lines:
# g++ 1.cpp -O3 -funroll-loops -fno-strict-aliasing -finline-functions
-fno-omit-frame-pointer -g3 -Wall -Wextra -Werror -Wconversion -Wformat
-Wmissing-declarations -Wshadow -Wstrict-prototypes -c 
cc1plus: error: command-line option ‘-Wstrict-prototypes’ is valid for C/ObjC
but not for C++ [-Werror]
1.cpp: In member function ‘c<Type>* c<Type>::A()’:
1.cpp:10:13: internal compiler error: Segmentation fault
   10 |     if  (d->b::State()) { }
      |             ^
0x27f432e internal_error(char const*, ...)
        /home/gcc-set/gcc24-7-24/gcc/diagnostic-global-context.cc:491
0x1412bf6 crash_signal
        /home/gcc-set/gcc24-7-24/gcc/toplev.cc:319
0xd2c40e perform_or_defer_access_check(tree_node*, tree_node*, tree_node*, int,
access_failure_info*)
        /home/gcc-set/gcc24-7-24/gcc/cp/semantics.cc:489
0xc5e95d cp_parser_lookup_name
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:32367
0xc9ab27 cp_parser_class_name
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:26826
0xc946f0 cp_parser_qualifying_entity
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:7422
0xc946f0 cp_parser_nested_name_specifier_opt
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:7104
0xc97969 cp_parser_id_expression
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:6447
0xc9c6a9 cp_parser_postfix_dot_deref_expression
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:8684
0xc92051 cp_parser_postfix_expression
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:8221
0xc677d1 cp_parser_binary_expression
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:10415
0xc685a5 cp_parser_assignment_expression
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:10759
0xc68ae4 cp_parser_expression
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:10926
0xca6dac cp_parser_condition
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:14062
0xcb0376 cp_parser_selection_statement
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:13694
0xc76dba cp_parser_statement
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:12743
0xc79f8f cp_parser_statement_seq_opt
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:13451
0xc7a20f cp_parser_compound_statement
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:13298
0xca2585 cp_parser_function_body
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:26175
0xca2585 cp_parser_ctor_initializer_opt_and_function_body
        /home/gcc-set/gcc24-7-24/gcc/cp/parser.cc:26226
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


*******************************************************************************

Also ICE on trunk, compiler explorer:https://godbolt.org/z/9jns9j8hz

*******************************************************************************

Reply via email to