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

            Bug ID: 117445
           Summary: ICE: in gimple_build_assign_1, at gimple.cc:480
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

*******************************************************************************
The compiler produces a ICE during gimple_build_assign_1 at gimple.cc:480 when
compiling the provided code with the specified options. 
The issue can also be reproduced on Compiler Explorer.

*******************************************************************************
OS and Platform:
# uname -a
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-241105/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-241105
--enable-languages=c,c++ --disable-multilib --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241105 (experimental) (GCC)
*******************************************************************************
Program:
# cat bugreport.c
int __attribute__((noipa))
__GIMPLE(startwith("dom1")) bar(int cond, int val)
{
  int i;

  if (0 != 0)
    goto bb_6;
  else
    goto bb_2;

bb_2:
  if (cond_5(D) != 0)
    goto bb_4;
  else
    goto bb_5;

bb_4:
  i_6 = val_2(D);
  i_1 = val_2(D) > 0 ? i_6 : 0;

bb_5:
  i_3 = __PHI (bb_4: i_1, bb_2: 0);
  return i_3;

bb_6:
  i_4 = 1;
  i_9 = 2;
  goto bb_2;
}

int main()
{
  if (bar (1, 1) != 1)
    __builtin_abort ();
  return 0;
}

*******************************************************************************
Command Lines:
# gcc bugreport.c -flto -Ofast -Wall -Wextra -fno-strict-aliasing -fwrapv -g
-fsanitize=address  -c -o bugreport.o

bugreport.c:2:1: error: ‘__GIMPLE’ only valid with ‘-fgimple’
    2 | __GIMPLE(startwith("dom1")) bar(int cond, int val)
      | ^~~~~~~~
bugreport.c: In function ‘bar’:
bugreport.c:19:3: internal compiler error: in gimple_build_assign_1, at
gimple.cc:480
   19 |   i_1 = val_2(D) > 0 ? i_6 : 0;
      |   ^~~
0x263b51e internal_error(char const*, ...)
        ../../gcc/gcc/diagnostic-global-context.cc:518
0x9e634b fancy_abort(char const*, int, char const*)
        ../../gcc/gcc/diagnostic.cc:1696
0x8152cd gimple_build_assign_1
        ../../gcc/gcc/gimple.cc:480
0x8155e2 gimple_build_assign_1
        ../../gcc/gcc/gimple.cc:484
0x8155e2 gimple_build_assign(tree_node*, tree_code, tree_node*, tree_node*,
tree_node*)
        ../../gcc/gcc/gimple.cc:504
0x8155e2 gimple_build_assign(tree_node*, tree_node*)
        ../../gcc/gcc/gimple.cc:456
0xaad71d c_parser_gimple_statement
        ../../gcc/gcc/c/gimple-parser.cc:909
0xaae42a c_parser_gimple_compound_statement
        ../../gcc/gcc/c/gimple-parser.cc:670
0xaafecc c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
        ../../gcc/gcc/c/gimple-parser.cc:254
0xa9aa22 c_parser_declaration_or_fndef
        ../../gcc/gcc/c/c-parser.cc:3029
0xaa5b67 c_parser_external_declaration
        ../../gcc/gcc/c/c-parser.cc:2063
0xaa660d c_parser_translation_unit
        ../../gcc/gcc/c/c-parser.cc:1917
0xaa660d c_parse_file()
        ../../gcc/gcc/c/c-parser.cc:27866
0xb246b1 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.cc:1352
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.

*******************************************************************************

Also ICE on trunk, compiler explorer:https://godbolt.org/z/ccd3KaaMr

*******************************************************************************

Reply via email to