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 c/68412] New: ICE with -Wall -Wextra in fold_binary_loc()


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

            Bug ID: 68412
           Summary: ICE with -Wall -Wextra in fold_binary_loc()
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sirl at gcc dot gnu.org
  Target Milestone: ---

With x86_64 gcc-6 r230524 (r230119 was still OK) compiling this little fragment
with -Wall -Wextra:

int testwarn(int *pCnShifted)
{
    int cnShifted = *pCnShifted;
    _Bool isNullSource = (cnShifted == ((-1) << (8)));

    if (!isNullSource)
        return 0;
    else
        return 1;
}

I see this ICE:

test.c: In function 'testwarn':
test.c:6:46: warning: left shift of negative value [-Wshift-negative-value]
     _Bool isNullSource = (cnShifted == ((-1) << (8)));
                                              ^~

test.c:6:5: internal compiler error: in fold_binary_loc, at fold-const.c:9085
     _Bool isNullSource = (cnShifted == ((-1) << (8)));
     ^~~~~

0x61056e fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ../../gcc/fold-const.c:9082
0x6214d4 fold(tree_node*)
        ../../gcc/fold-const.c:11974
0x48ee10 warn_tautological_cmp(unsigned int, tree_code, tree_node*, tree_node*)
        ../../gcc/c-family/c-common.c:1927
0x454cb6 parser_build_binary_op(unsigned int, tree_code, c_expr, c_expr)
        ../../gcc/c/c-typeck.c:3528
0x470c08 c_parser_binary_expression
        ../../gcc/c/c-parser.c:6544
0x471075 c_parser_conditional_expression
        ../../gcc/c/c-parser.c:6187
0x471570 c_parser_expr_no_commas
        ../../gcc/c/c-parser.c:6104
0x471a92 c_parser_expression
        ../../gcc/c/c-parser.c:8250
0x46ce4f c_parser_postfix_expression
        ../../gcc/c/c-parser.c:7412
0x46f45a c_parser_unary_expression
        ../../gcc/c/c-parser.c:6774
0x470137 c_parser_cast_expression
        ../../gcc/c/c-parser.c:6607
0x470355 c_parser_binary_expression
        ../../gcc/c/c-parser.c:6416
0x471075 c_parser_conditional_expression
        ../../gcc/c/c-parser.c:6187
0x471570 c_parser_expr_no_commas
        ../../gcc/c/c-parser.c:6104
0x47fd5a c_parser_initializer
        ../../gcc/c/c-parser.c:4225
0x4690fc c_parser_declaration_or_fndef
        ../../gcc/c/c-parser.c:1850
0x46c8cb c_parser_compound_statement_nostart
        ../../gcc/c/c-parser.c:4688
0x480fce c_parser_compound_statement
        ../../gcc/c/c-parser.c:4599
0x469a41 c_parser_declaration_or_fndef
        ../../gcc/c/c-parser.c:2017
0x48460d c_parser_external_declaration
        ../../gcc/c/c-parser.c:1461

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