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

            Bug ID: 70651
           Summary: ICE on valid code on x86_64-linux-gnu in build_va_arg,
                    at c-family/c-common.c:5728
           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 on
x86_64-linux-gnu in both 32-bit and 64-bit modes.  

It is a regression from 5.3.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-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 6.0.0 20160413 (experimental) [trunk revision 234931] (GCC)
$
$ gcc-5.3 -c small.c
$
$ gcc-trunk -c small.c
small.c: In function ‘fn1’:
small.c:4:3: internal compiler error: in build_va_arg, at
c-family/c-common.c:5728
   __builtin_va_arg (a, char **);
   ^~~~~~~~~~~~~~~~
0x6addfb build_va_arg(unsigned int, tree_node*, tree_node*)
        ../../gcc-source-trunk/gcc/c-family/c-common.c:5728
0x648643 c_parser_postfix_expression
        ../../gcc-source-trunk/gcc/c/c-parser.c:7615
0x64ab9a c_parser_unary_expression
        ../../gcc-source-trunk/gcc/c/c-parser.c:6890
0x64b9aa c_parser_cast_expression
        ../../gcc-source-trunk/gcc/c/c-parser.c:6719
0x64bbb4 c_parser_binary_expression
        ../../gcc-source-trunk/gcc/c/c-parser.c:6528
0x64c865 c_parser_conditional_expression
        ../../gcc-source-trunk/gcc/c/c-parser.c:6299
0x64cee0 c_parser_expr_no_commas
        ../../gcc-source-trunk/gcc/c/c-parser.c:6216
0x64d5e2 c_parser_expression
        ../../gcc-source-trunk/gcc/c/c-parser.c:8403
0x64e049 c_parser_expression_conv
        ../../gcc-source-trunk/gcc/c/c-parser.c:8436
0x66435c c_parser_statement_after_labels
        ../../gcc-source-trunk/gcc/c/c-parser.c:5272
0x666139 c_parser_compound_statement_nostart
        ../../gcc-source-trunk/gcc/c/c-parser.c:4856
0x6669ce c_parser_compound_statement
        ../../gcc-source-trunk/gcc/c/c-parser.c:4692
0x667bf7 c_parser_declaration_or_fndef
        ../../gcc-source-trunk/gcc/c/c-parser.c:2104
0x670d15 c_parser_external_declaration
        ../../gcc-source-trunk/gcc/c/c-parser.c:1548
0x6715a9 c_parser_translation_unit
        ../../gcc-source-trunk/gcc/c/c-parser.c:1429
0x6715a9 c_parse_file()
        ../../gcc-source-trunk/gcc/c/c-parser.c:17842
0x6d2c52 c_common_parse_file()
        ../../gcc-source-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.
$


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


void fn1 ()
{ 
  char **a = 0;
  __builtin_va_arg (a, char **);
}

Reply via email to