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

            Bug ID: 68449
           Summary: ICE in cxx_eval_constant_expression on atomic_load in
                    C++
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Compiling the following program with the latest trunk triggers a number of
errors due to the _Atomic qualifier that's not recognized in C++ followed by an
ICE:

$ cat z.cpp && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S
-Wall -o/dev/null  -xc++ z.cpp
#include <stdatomic.h>

int foo (int *p)
{
    return atomic_load (p) < 0;
}

After reducing that to a small test case I ended up with the following valid
code.

Searching for cxx_eval_constant_expression suggests this might be a duplicate
of bug 68348.

$ cat z.ii && /build/gcc-trunk-svn/gcc/xgcc -B /build/gcc-trunk-svn/gcc -S
-Wall -o/dev/null -xc++ z.ii
int foo (int a)
{
    return __extension__ ({
        __typeof__ (a) b;
        b; }) < 0;
}
z.ii: In function ‘int foo(int)’:
z.ii:5:17: internal compiler error: Segmentation fault
         b; }) < 0;
                 ^

0xffa298 crash_signal
        /home/msebor/scm/fsf/gcc-svn/gcc/toplev.c:334
0x9f417f cxx_eval_constant_expression
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/constexpr.c:3198
0x9f377d cxx_eval_statement_list
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/constexpr.c:3029
0x9f59ce cxx_eval_constant_expression
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/constexpr.c:3614
0x9f5a4d cxx_eval_constant_expression
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/constexpr.c:3620
0x9f628a cxx_eval_outermost_constant_expr
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/constexpr.c:3774
0x9f6c9c maybe_constant_value_1
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/constexpr.c:3960
0x9f6d99 maybe_constant_value(tree_node*, tree_node*)
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/constexpr.c:3981
0x8f5e3c cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*,
int)
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/typeck.c:5045
0x73e1d4 build_new_op_1
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/call.c:5758
0x73e2c8 build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*,
tree_node*, tree_node**, int)
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/call.c:5803
0x8f1d8f build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code,
tree_node*, tree_code, tree_node**, int)
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/typeck.c:3828
0x892faa cp_parser_binary_expression
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:8591
0x8932a1 cp_parser_assignment_expression
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:8712
0x893511 cp_parser_expression
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:8871
0x8981bc cp_parser_jump_statement
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:11408
0x895904 cp_parser_statement
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:10035
0x896408 cp_parser_statement_seq_opt
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:10426
0x896303 cp_parser_compound_statement
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:10380
0x8a70f3 cp_parser_function_body
        /home/msebor/scm/fsf/gcc-svn/gcc/cp/parser.c:20192
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
tmp$

Reply via email to