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

            Bug ID: 122239
           Summary: ICE: in gimplify_expr, at gimplify.cc:20511
           Product: gcc
           Version: 15.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: qingren2hxb at gmail dot com
  Target Milestone: ---

Created attachment 62535
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62535&action=edit
bug report by using -freport-bug

*************************************************************
# g++ -v
Using built-in specs.
COLLECT_GCC=/workspace/installation/bin/g++
COLLECT_LTO_WRAPPER=/workspace/installation/libexec/gcc/x86_64-pc-linux-gnu/15.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/gcc/configure --prefix=/workspace/installation
--enable-coverage --enable-checking --disable-multilib --disable-shared
--disable-bootstrap --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.0 (GCC) 

*************************************************************
# g++ test.c -std=c++98

//-std=c++98
int main() {
  // Mutated: Add statement expressions as asm inputs
  __asm__ ("" : : "m" (({ if (1) printf("a"); })));
  __asm__ ("" : : "m" (({ while (0) printf("b"); })));

  // Mutated: Multiple calls to printf scattered throughout
  printf("a");
  if (1) {
    printf("b");
  }
  for (int i = 0; i < 1; i++) {
    printf("c");
  }
  __asm__ ("" : : "m" (({ switch (1) { case 1: printf("d"); } })));

  return 0;
}

*************************************************************
test.c: In function 'int main()':
test.c:3:34: error: 'printf' was not declared in this scope
    3 |   __asm__ ("" : : "m" (({ if (1) printf("a"); })));
      |                                  ^~~~~~
test.c:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably
fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | //-std=c++98
test.c:4:37: error: 'printf' was not declared in this scope
    4 |   __asm__ ("" : : "m" (({ while (0) printf("b"); })));
      |                                     ^~~~~~
test.c:4:37: note: 'printf' is defined in header '<cstdio>'; this is probably
fixable by adding '#include <cstdio>'
test.c:6:3: error: 'printf' was not declared in this scope
    6 |   printf("a");
      |   ^~~~~~
test.c:6:3: note: 'printf' is defined in header '<cstdio>'; this is probably
fixable by adding '#include <cstdio>'
test.c:3:3: error: memory input 0 is not directly addressable
    3 |   __asm__ ("" : : "m" (({ if (1) printf("a"); })));
      |   ^~~~~~~
test.c:4:3: error: memory input 0 is not directly addressable
    4 |   __asm__ ("" : : "m" (({ while (0) printf("b"); })));
      |   ^~~~~~~
test.c:13:24: internal compiler error: in gimplify_expr, at gimplify.cc:20511
   13 |   __asm__ ("" : : "m" (({ switch (1) { case 1: printf("d"); } })));
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x5d4e2e6 internal_error(char const*, ...)
        /workspace/gcc/gcc/diagnostic-global-context.cc:517
0x5cf3c1f fancy_abort(char const*, int, char const*)
        /workspace/gcc/gcc/diagnostic.cc:1749
0x1f7ec2b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /workspace/gcc/gcc/gimplify.cc:20511
0x1f1ebbe gimplify_asm_expr
        /workspace/gcc/gcc/gimplify.cc:8077
0x1f7a990 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /workspace/gcc/gcc/gimplify.cc:19863
0x1f21447 gimplify_stmt(tree_node**, gimple**)
        /workspace/gcc/gcc/gimplify.cc:8458
0x1f20124 gimplify_cleanup_point_expr
        /workspace/gcc/gcc/gimplify.cc:8196
0x1f7b2cd gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /workspace/gcc/gcc/gimplify.cc:19929
0x1f21447 gimplify_stmt(tree_node**, gimple**)
        /workspace/gcc/gcc/gimplify.cc:8458
0x1efa0fd gimplify_statement_list
        /workspace/gcc/gcc/gimplify.cc:2285
0x1f7b8b6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /workspace/gcc/gcc/gimplify.cc:19981
0x1f21447 gimplify_stmt(tree_node**, gimple**)
        /workspace/gcc/gcc/gimplify.cc:8458
0x1ef6283 gimplify_bind_expr
        /workspace/gcc/gcc/gimplify.cc:1680
0x1f79b02 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /workspace/gcc/gcc/gimplify.cc:19731
0x1f21447 gimplify_stmt(tree_node**, gimple**)
        /workspace/gcc/gcc/gimplify.cc:8458
0x1efa0fd gimplify_statement_list
        /workspace/gcc/gcc/gimplify.cc:2285
0x1f7b8b6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /workspace/gcc/gcc/gimplify.cc:19981
0x1f21447 gimplify_stmt(tree_node**, gimple**)
        /workspace/gcc/gcc/gimplify.cc:8458
0x1f80a63 gimplify_body(tree_node*, bool)
        /workspace/gcc/gcc/gimplify.cc:20833
0x1f81cdb gimplify_function_tree(tree_node*)
        /workspace/gcc/gcc/gimplify.cc:21042
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
  • [Bug c++/122239] New: ICE: in gi... qingren2hxb at gmail dot com via Gcc-bugs

Reply via email to