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

            Bug ID: 83059
           Summary: ICE on invalid C++ code: in tree_to_uhwi, at
                    tree.c:6633
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

It seems to affect at least all versions as early as 4.8.x. 

$ g++tk -v
Using built-in specs.
COLLECT_GCC=g++tk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20171119 (experimental) [trunk revision 254940] (GCC)
$
$ g++-4.8 -c tmp.cpp
tmp.cpp: In member function ‘void A::f()’:
tmp.cpp:11:54: internal compiler error: in tree_low_cst, at tree.h:4851
   __atomic_compare_exchange (&i, &a, &b, false, 0, -1);
                                                      ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccbLk5Tw.out file, please attach this to
your bugreport.
ERROR: Cannot create report: [Errno 17] File exists:
'/var/crash/_usr_lib_gcc_x86_64-linux-gnu_4.8_cc1plus.1001.crash'
$
$ g++tk -c tmp.cpp
tmp.cpp: In member function ‘void A::f()’:
tmp.cpp:11:54: internal compiler error: in tree_to_uhwi, at tree.c:6633
   __atomic_compare_exchange (&i, &a, &b, false, 0, -1);
                                                      ^
0x11376e2 tree_to_uhwi(tree_node const*)
        ../../gcc-source-trunk/gcc/tree.c:6633
0x92692d get_atomic_generic_size
        ../../gcc-source-trunk/gcc/c-family/c-common.c:6674
0x95a55a resolve_overloaded_atomic_compare_exchange
        ../../gcc-source-trunk/gcc/c-family/c-common.c:6834
0x95a55a resolve_overloaded_builtin(unsigned int, tree_node*, vec<tree_node*,
va_gc, vl_embed>*)
        ../../gcc-source-trunk/gcc/c-family/c-common.c:7075
0x8ba6ef finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc-source-trunk/gcc/cp/semantics.c:2450
0x81060c cp_parser_postfix_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:7239
0x82b97c cp_parser_unary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:8363
0x7fafcc cp_parser_cast_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9131
0x7fb733 cp_parser_binary_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9232
0x7fc020 cp_parser_assignment_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9519
0x7fc8ca cp_parser_expression
        ../../gcc-source-trunk/gcc/cp/parser.c:9688
0x8001a9 cp_parser_expression_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11205
0x80b895 cp_parser_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11021
0x80cb9f cp_parser_statement_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:11348
0x80ccaf cp_parser_compound_statement
        ../../gcc-source-trunk/gcc/cp/parser.c:11302
0x825490 cp_parser_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:21840
0x825490 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc-source-trunk/gcc/cp/parser.c:21875
0x825edc cp_parser_function_definition_after_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:26766
0x826ccd cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:26683
0x826ccd cp_parser_init_declarator
        ../../gcc-source-trunk/gcc/cp/parser.c:19541
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.
$


-----------------------------


class A
{ 
  void f ();
  int i;
} a;

int b;

void A::f ()
{ 
  __atomic_compare_exchange (&i, &a, &b, false, 0, -1);
}

Reply via email to