This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug inline-asm/85172] New: internal compiler error: unexpected expression '<statement>' of kind asm_expr


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

            Bug ID: 85172
           Summary: internal compiler error: unexpected expression
                    '<statement>' of kind asm_expr
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at oracle dot com
  Target Milestone: ---

Input (valid code AFAICT):

int f() {
  return !__builtin_constant_p(({
    asm("");
    0;
  }));
}

Output:

$ cc1plus
 int f()
output/unexpected-expression.cc:5:5: internal compiler error: unexpected
expression '<statement>' of kind asm_expr
   }));
     ^
0xa38827 cxx_eval_constant_expression
        /home/vegard/git/gcc/gcc/cp/constexpr.c:4786
0xa31d62 cxx_eval_constant_expression
        /home/vegard/git/gcc/gcc/cp/constexpr.c:4423
0xa306a3 cxx_eval_statement_list
        /home/vegard/git/gcc/gcc/cp/constexpr.c:3922
0xa306a3 cxx_eval_constant_expression
        /home/vegard/git/gcc/gcc/cp/constexpr.c:4670
0xa5bc38 cxx_eval_builtin_function_call
        /home/vegard/git/gcc/gcc/cp/constexpr.c:1189
0xa24598 cxx_eval_call_expression
        /home/vegard/git/gcc/gcc/cp/constexpr.c:1496
0xa31c70 cxx_eval_constant_expression
        /home/vegard/git/gcc/gcc/cp/constexpr.c:4200
0xa4b8ca cxx_eval_outermost_constant_expr
        /home/vegard/git/gcc/gcc/cp/constexpr.c:4846
0xa591b6 maybe_constant_value(tree_node*, tree_node*)
        /home/vegard/git/gcc/gcc/cp/constexpr.c:5063
0xab906a cp_fully_fold(tree_node*)
        /home/vegard/git/gcc/gcc/cp/cp-gimplify.c:2071
0x13da147 cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*,
int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:5391
0xae49c7 ocp_convert(tree_node*, tree_node*, int, int, int)
        /home/vegard/git/gcc/gcc/cp/cvt.c:812
0xaec6ac cp_convert(tree_node*, tree_node*, int)
        /home/vegard/git/gcc/gcc/cp/cvt.c:623
0xaec6ac cp_convert_and_check(tree_node*, tree_node*, int)
        /home/vegard/git/gcc/gcc/cp/cvt.c:642
0x8e068f convert_like_real
        /home/vegard/git/gcc/gcc/cp/call.c:7116
0x8e5c29 perform_implicit_conversion_flags(tree_node*, tree_node*, int, int)
        /home/vegard/git/gcc/gcc/cp/call.c:10669
0x13c91f8 cp_build_unary_op(tree_code, tree_node*, bool, int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:6148
0x94399b build_new_op_1
        /home/vegard/git/gcc/gcc/cp/call.c:6026
0x946036 build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*,
tree_node*, tree_node**, int)
        /home/vegard/git/gcc/gcc/cp/call.c:6058
0x13d000c build_x_unary_op(unsigned int, tree_code, cp_expr, int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:5601
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.

$ xgcc --version
xgcc (GCC) 8.0.1 20180322 (experimental)

6.3.0 generates code for "return 1", i.e. __builtin_constant_p() on an
expression containing an empty asm() returned 0 (which seems sensible, as I
don't think gcc should know anything about what is inside the asm string).

7.1.0 ICEs as well.

Test case was minimised by C-Reduce.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]