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

            Bug ID: 68447
           Summary: ICE with -Wall on valid code on x86_64-linux-gnu in
                    fold_binary_loc, at fold-const.c:9085
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk with
-Wall enabled on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It is a regression from 5.2.x.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20151118 (experimental) [trunk revision 230547] (GCC) 
$ 
$ gcc-trunk -c small.c    
$ gcc-5.2 -Wall -c small.c
small.c: In function ‘fn1’:
small.c:6:10: warning: left-hand operand of comma expression has no effect
[-Wunused-value]
   a != (0, 0); 
          ^
small.c:6:3: warning: statement with no effect [-Wunused-value]
   a != (0, 0); 
   ^
$ 
$ gcc-trunk -Wall -c small.c
small.c: In function ‘fn1’:
small.c:6:10: warning: left-hand operand of comma expression has no effect
[-Wunused-value]
   a != (0, 0);
          ^

small.c:6:3: internal compiler error: in fold_binary_loc, at fold-const.c:9085
   a != (0, 0);
   ^

0x83befd fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ../../gcc-trunk/gcc/fold-const.c:9082
0x858f94 fold(tree_node*)
        ../../gcc-trunk/gcc/fold-const.c:11974
0x649880 warn_tautological_cmp(unsigned int, tree_code, tree_node*, tree_node*)
        ../../gcc-trunk/gcc/c-family/c-common.c:1927
0x601e5f parser_build_binary_op(unsigned int, tree_code, c_expr, c_expr)
        ../../gcc-trunk/gcc/c/c-typeck.c:3515
0x613678 c_parser_binary_expression
        ../../gcc-trunk/gcc/c/c-parser.c:6544
0x613b35 c_parser_conditional_expression
        ../../gcc-trunk/gcc/c/c-parser.c:6187
0x6141d0 c_parser_expr_no_commas
        ../../gcc-trunk/gcc/c/c-parser.c:6104
0x6148f2 c_parser_expression
        ../../gcc-trunk/gcc/c/c-parser.c:8250
0x615339 c_parser_expression_conv
        ../../gcc-trunk/gcc/c/c-parser.c:8283
0x62e4d1 c_parser_statement_after_labels
        ../../gcc-trunk/gcc/c/c-parser.c:5177
0x630594 c_parser_compound_statement_nostart
        ../../gcc-trunk/gcc/c/c-parser.c:4762
0x63098e c_parser_compound_statement
        ../../gcc-trunk/gcc/c/c-parser.c:4599
0x62c54b c_parser_declaration_or_fndef
        ../../gcc-trunk/gcc/c/c-parser.c:2017
0x637e6d c_parser_external_declaration
        ../../gcc-trunk/gcc/c/c-parser.c:1461
0x638869 c_parser_translation_unit
        ../../gcc-trunk/gcc/c/c-parser.c:1348
0x638869 c_parse_file()
        ../../gcc-trunk/gcc/c/c-parser.c:17658
0x6988d2 c_common_parse_file()
        ../../gcc-trunk/gcc/c-family/c-opts.c:1064
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.
$ 


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


int a;

void
fn1 ()
{
  a != (0, 0); 
}

Reply via email to