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

            Bug ID: 87774
           Summary: ICE on ternary expression with __builtin_fprintf
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC fails with an ICE on the program below.

#include <stdio.h>

extern "C" int ff (FILE*, const char*, ...);

void f (FILE *fp)
{
  (fp ? __builtin_fprintf : ff)(fp, "abc");
}
t.C: In function ‘void f(FILE*)’:
t.C:7:29: internal compiler error: canonical types differ for identical types
‘int(FILE*, const char*, ...)’ {aka ‘int(_IO_FILE*, const char*, ...)’} and
‘int(FILE*, const char*, ...)’ {aka ‘int(_IO_FILE*, const char*, ...)’}
    7 |   (fp ? __builtin_fprintf : ff)(fp, "abc");
      |                             ^~
0xb2ff79 comptypes(tree_node*, tree_node*, int)
        /ssd/src/gcc/git-svn/gcc/cp/typeck.c:1480
0x82f723 build_conditional_expr_1
        /ssd/src/gcc/git-svn/gcc/cp/call.c:5112
0x830c73 build_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
        /ssd/src/gcc/git-svn/gcc/cp/call.c:5460
0xb41d68 build_x_conditional_expr(unsigned int, tree_node*, tree_node*,
tree_node*, int)
        /ssd/src/gcc/git-svn/gcc/cp/typeck.c:6668
0x9e858e cp_parser_question_colon_clause
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:9473
0x9e869c cp_parser_assignment_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:9509
0x9e89dc cp_parser_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:9672
0x9ded44 cp_parser_primary_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:5255
0x9e320c cp_parser_postfix_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:7060
0x9e6695 cp_parser_unary_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:8339
0x9e7773 cp_parser_cast_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:9107
0x9e7857 cp_parser_binary_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:9208
0x9e8651 cp_parser_assignment_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:9503
0x9e89dc cp_parser_expression
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:9672
0x9ebd29 cp_parser_expression_statement
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:11160
0x9eb620 cp_parser_statement
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:10964
0x9ec28b cp_parser_statement_seq_opt
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:11303
0x9ec181 cp_parser_compound_statement
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:11257
0xa004d9 cp_parser_function_body
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:21926
0xa0069d cp_parser_ctor_initializer_opt_and_function_body
        /ssd/src/gcc/git-svn/gcc/cp/parser.c:21961
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.

Reply via email to