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

            Bug ID: 77624
           Summary: ICE on x86_64-linux-gnu (internal compiler error: in
                    fold_builtin_atomic_always_lock_free, at
                    builtins.c:5583)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

This is a regression. gcc-4.9 does not ICE.


$ 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/7.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 7.0.0 20160916 (experimental) [trunk revision 240207] (GCC) 
$ gcc-trunk -c small.c 
small.c: In function ‘main’:
small.c:3:28: warning: passing argument 2 of ‘__atomic_is_lock_free’ makes
pointer from integer without a cast [-Wint-conversion]
   __atomic_is_lock_free(2, a);
                            ^
small.c:3:28: note: expected ‘const volatile void *’ but argument is of type
‘int’
small.c:3:3: internal compiler error: in fold_builtin_atomic_always_lock_free,
at builtins.c:5583
   __atomic_is_lock_free(2, a);
   ^~~~~~~~~~~~~~~~~~~~~
0x75875e fold_builtin_atomic_always_lock_free
        ../../gcc-source-trunk/gcc/builtins.c:5583
0x758b44 fold_builtin_atomic_always_lock_free
        ../../gcc-source-trunk/gcc/builtins.c:5644
0x758b44 fold_builtin_atomic_is_lock_free
        ../../gcc-source-trunk/gcc/builtins.c:5640
0x769b9b fold_builtin_2
        ../../gcc-source-trunk/gcc/builtins.c:8440
0x769b9b fold_builtin_n(unsigned int, tree_node*, tree_node**, int, bool)
        ../../gcc-source-trunk/gcc/builtins.c:8548
0x8eb2f9 fold(tree_node*)
        ../../gcc-source-trunk/gcc/fold-const.c:11910
0x6bc6f2 c_fully_fold_internal
        ../../gcc-source-trunk/gcc/c/c-fold.c:556
0x6c019a c_fully_fold(tree_node*, bool, bool*)
        ../../gcc-source-trunk/gcc/c/c-fold.c:90
0x657e0c c_process_expr_stmt(unsigned int, tree_node*)
        ../../gcc-source-trunk/gcc/c/c-typeck.c:10342
0x6581fd c_finish_expr_stmt(unsigned int, tree_node*)
        ../../gcc-source-trunk/gcc/c/c-typeck.c:10387
0x6a5fc8 c_parser_statement_after_labels
        ../../gcc-source-trunk/gcc/c/c-parser.c:5347
0x6a7f2b c_parser_compound_statement_nostart
        ../../gcc-source-trunk/gcc/c/c-parser.c:4921
0x6a881e c_parser_compound_statement
        ../../gcc-source-trunk/gcc/c/c-parser.c:4756
0x6a9d48 c_parser_declaration_or_fndef
        ../../gcc-source-trunk/gcc/c/c-parser.c:2155
0x6b3446 c_parser_external_declaration
        ../../gcc-source-trunk/gcc/c/c-parser.c:1570
0x6b3f59 c_parser_translation_unit
        ../../gcc-source-trunk/gcc/c/c-parser.c:1450
0x6b3f59 c_parse_file()
        ../../gcc-source-trunk/gcc/c/c-parser.c:18090
0x71e332 c_common_parse_file()
        ../../gcc-source-trunk/gcc/c-family/c-opts.c:1073
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.
$ 
$ gcc-4.9 small.c  -c
small.c: In function ‘main’:
small.c:3:28: warning: passing argument 2 of ‘__atomic_is_lock_free’ makes
pointer from integer without a cast
   __atomic_is_lock_free(2, a); 
                            ^
small.c:3:28: note: expected ‘const volatile void *’ but argument is of type
‘int’
$ 
$ cat small.c 
int a;
int main() { 
  __atomic_is_lock_free(2, a); 
  return 0;
}
$

Reply via email to