[Bug sanitizer/114956] New: Segmentation fault with -fsanitize=address -fsanitize=null -O2 when attribute no_sanitize_address is enabled

2024-05-05 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114956

Bug ID: 114956
   Summary: Segmentation fault with -fsanitize=address
-fsanitize=null -O2 when attribute no_sanitize_address
is enabled
   Product: gcc
   Version: 15.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/33rbWdf49

***
gcc version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/home/gcc_set/gcc-trunk/bin/gcc
COLLECT_LTO_WRAPPER=/home/gcc_set/gcc-trunk/libexec/gcc/aarch64-unknown-linux-gnu/15.0.0/lto-wrapper
Target: aarch64-unknown-linux-gnu
Configured with: ../gcc/configure --prefix=/home/gcc_set/gcc-trunk
--with-gmp=/home/build_essential --with-mpfr=/home/build_essential
--with-mpc=/home/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leakcd CC=gcc CXX=g++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240430 (experimental) (GCC)

git version: 22b20ac6c6aead2d3f36c413a77dd0b80adfec39
***
Program:
$ cat mutant.c
int **a;
__attribute__((always_inline)) int *c() {
  int b[1];
  b;
}
__attribute__((no_sanitize_address)) static char d() { *a = c(); }
void e() { d(); }

***
Command Lines:
$ gcc -fsanitize=address -fsanitize=null -O2 -c mutant.c
mutant.c:2:37: warning: 'always_inline' function might not be inlinable unless
also declared 'inline' [-Wattributes]
2 | __attribute__((always_inline)) int *c() {
  | ^
during GIMPLE pass: sanopt
mutant.c: In function 'd.isra':
mutant.c:6:50: internal compiler error: Segmentation fault
6 | __attribute__((no_sanitize_address)) static char d() { *a = c(); }
  |  ^
0xf2d49b crash_signal
../../gcc/gcc/toplev.cc:319
0xf3fcfc contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/gcc/tree.h:3769
0xf3fcfc build_shadow_mem_access
../../gcc/gcc/asan.cc:2552
0xf4b90f asan_expand_mark_ifn(gimple_stmt_iterator*)
../../gcc/gcc/asan.cc:3854
0xf5f6bf execute
../../gcc/gcc/sanopt.cc:1379
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions

[Bug analyzer/114899] New: Segmentation fault with -fsanitize=undefined and -fanalyzer since r14-2029-g0e466e978c7

2024-04-30 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114899

Bug ID: 114899
   Summary: Segmentation fault with -fsanitize=undefined and
-fanalyzer since r14-2029-g0e466e978c7
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/v8c4csjTE

Bisected to r14-2029-g0e466e978c7

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202404101100/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202404101100/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202404101100
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240410 (experimental) (GCC) 

git version: 0774240b4df9a9bc48ce33a9625788e402498f5a
***
Program:
$ cat mutant.c
void a() {
  int *b = __builtin_malloc(0);
  int *c = b - 1;
  ++*c;
}

***
Command Lines:
$ gcc -fsanitize=undefined -fanalyzer -c mutant.c
mutant.c: In function ‘a’:
mutant.c:3:3: warning: heap-based buffer underwrite [CWE-124]
[-Wanalyzer-out-of-bounds]
3 |   ++*c;
  |   ^~~~
  ‘a’: events 1-2
|
|2 |   int *b = __builtin_malloc(0), *c = b - 1;
|  |^~~
|  ||
|  |(1) capacity: 0 bytes
|3 |   ++*c;
|  |     
|  |   |
|  |   (2) out-of-bounds write from byte -4 till byte -1 but region
starts at byte 0
|
during IPA pass: analyzer
mutant.c:3:3: internal compiler error: Segmentation fault
3 |   ++*c;
  |   ^~~~
0x1043a4f crash_signal
../../gcc/gcc/toplev.cc:319
0x216f0e6
ana::written_svalue_spatial_item::get_label_string(text_art::style_manager&)
const
../../gcc/gcc/analyzer/access-diagram.cc:1632
0x216f290 ana::written_svalue_spatial_item::make_table(ana::bit_to_table_map
const&, text_art::style_manager&) const
../../gcc/gcc/analyzer/access-diagram.cc:1620
0x2170348 ana::access_diagram_impl::access_diagram_impl(ana::access_operation
const&, diagnostic_event_id_t, text_art::style_manager&, text_art::theme
const&, ana::logger*)
../../gcc/gcc/analyzer/access-diagram.cc:2131
0x2165157 std::enable_if::value,
std::unique_ptr > >::type
make_unique(ana::access_operation const&, diagnostic_event_id_t&,
text_art::style_manager&, text_art::theme const&, ana::logger*&)
../../gcc/gcc/make-unique.h:41
0x2165157 ana::access_diagram::access_diagram(ana::access_operation const&,
diagnostic_event_id_t, text_art::style_manager&, text_art::theme const&,
ana::logger*)
../../gcc/gcc/analyzer/access-diagram.cc:2679
0x2176727 ana::out_of_bounds::make_access_diagram(ana::access_operation const&,
text_art::style_manager&, text_art::theme const&, ana::logger*) const
../../gcc/gcc/analyzer/bounds-checking.cc:208
0x2176727 ana::out_of_bounds::maybe_show_diagram(ana::logger*) const
../../gcc/gcc/analyzer/bounds-checking.cc:187
0x2176c51
ana::concrete_buffer_underwrite::emit(ana::diagnostic_emission_context&)
../../gcc/gcc/analyzer/bounds-checking.cc:694
0x219c5c1 ana::diagnostic_manager::emit_saved_diagnostic(ana::exploded_graph
const&, ana::saved_diagnostic&)
../../gcc/gcc/analyzer/diagnostic-manager.cc:1617
0x21a02ed ana::dedupe_winners::emit_best(ana::diagnostic_manager*,
ana::exploded_graph const&)
../../gcc/gcc/analyzer/diagnostic-manager.cc:1472
0x219cb35 ana::diagnostic_manager::emit_saved_diagnostics(ana::exploded_graph
const&)
../../gcc/gcc/analyzer/diagnostic-manager.cc:1524
0x1453c7b ana::impl_run_checkers(ana::logger*)
../../gcc/gcc/analyzer/engine.cc:6227
0x1454bb6 ana::run_checkers()
../../gcc/gcc/analyzer/engine.cc:6308
0x1443a98 execute
../../gcc/gcc/analyzer/analyzer-pass.cc:87
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug analyzer/114897] ICE in get_or_create_widening_svalue, at analyzer/region-model-manager.cc:1336 since r13-3077-gbfca9505f6f

2024-04-30 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114897

--- Comment #1 from Anonymous  ---
There is another case that triggers the ICE in replay_call_summary_cluster, at
analyzer/store.cc:3374

Also bisected to r13-3077-gbfca9505f6f

Compiler Explorer: https://godbolt.org/z/Wh5MGf739

Program:
$ cat mutant.c
__attribute__((__vector_size__(sizeof(float float a;
int b;
void c();
void d() {
  for (; b;)
if (a[b])
  c();
}
void e() {
  d();
  d();
}

***
Command Lines:
$ gcc -fsanitize=undefined -fanalyzer -fanalyzer-call-summaries -c mutant.c
during IPA pass: analyzer
mutant.c: In function ‘e’:
mutant.c:10:3: internal compiler error: in replay_call_summary_cluster, at
analyzer/store.cc:3374
   10 |   d();
  |   ^~~
0x8921e5 ana::store::replay_call_summary_cluster(ana::call_summary_replay&,
ana::store const&, ana::region const*)
../../gcc/gcc/analyzer/store.cc:3374
0x14e1864 ana::store::replay_call_summary(ana::call_summary_replay&, ana::store
const&)
../../gcc/gcc/analyzer/store.cc:3318
0x149174b ana::region_model::replay_call_summary(ana::call_summary_replay&,
ana::region_model const&)
../../gcc/gcc/analyzer/region-model.cc:5635
0x14723eb ana::program_state::replay_call_summary(ana::call_summary_replay&,
ana::program_state const&)
../../gcc/gcc/analyzer/program-state.cc:1635
0x1458743 ana::call_summary_edge_info::update_state(ana::program_state*,
ana::exploded_edge const*, ana::region_model_context*) const
../../gcc/gcc/analyzer/engine.cc:1633
0x1450d9a ana::exploded_graph::process_node(ana::exploded_node*)
../../gcc/gcc/analyzer/engine.cc:4241
0x145166a ana::exploded_graph::process_worklist()
../../gcc/gcc/analyzer/engine.cc:3516
0x1453c4b ana::impl_run_checkers(ana::logger*)
../../gcc/gcc/analyzer/engine.cc:6210
0x1454bb6 ana::run_checkers()
../../gcc/gcc/analyzer/engine.cc:6308
0x1443a98 execute
../../gcc/gcc/analyzer/analyzer-pass.cc:87
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug analyzer/114897] New: ICE in get_or_create_widening_svalue, at analyzer/region-model-manager.cc:1336 since r13-3077-gbfca9505f6f

2024-04-30 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114897

Bug ID: 114897
   Summary: ICE in get_or_create_widening_svalue, at
analyzer/region-model-manager.cc:1336 since
r13-3077-gbfca9505f6f
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/WMK1K7cMs

Bisected to r13-3077-gbfca9505f6f

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202404101100/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202404101100/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202404101100
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240410 (experimental) (GCC) 

git version: 0774240b4df9a9bc48ce33a9625788e402498f5a
***
Program:
$ cat mutant.c
int a, b;
char *c;
char *e(char *f) {
  while (a) {
unsigned d = *f++;
  }
  return b ? f : 0;
}
void g() {
  c = e(c);
  e(c);
}

***
Command Lines:
$ gcc -fanalyzer -fanalyzer-call-summaries -c mutant.c
during IPA pass: analyzer
mutant.c: In function ‘g’:
mutant.c:11:3: internal compiler error: in get_or_create_widening_svalue, at
analyzer/region-model-manager.cc:1336
   11 |   e(c);
  |   ^~~~
0x88f731 ana::region_model_manager::get_or_create_widening_svalue(tree_node*,
ana::function_point const&, ana::svalue const*, ana::svalue const*)
../../gcc/gcc/analyzer/region-model-manager.cc:1336
0x217b2aa ana::call_summary_replay::convert_svalue_from_summary(ana::svalue
const*)
../../gcc/gcc/analyzer/call-summary.cc:236
0x219584b ana::replay_fact_visitor::on_fact(ana::svalue const*, tree_code,
ana::svalue const*)
../../gcc/gcc/analyzer/constraint-manager.cc:3273
0x2189728 ana::constraint_manager::for_each_fact(ana::fact_visitor*) const
../../gcc/gcc/analyzer/constraint-manager.cc:3240
0x2189958
ana::constraint_manager::replay_call_summary(ana::call_summary_replay&,
ana::constraint_manager const&)
../../gcc/gcc/analyzer/constraint-manager.cc:3307
0x1491770 ana::region_model::replay_call_summary(ana::call_summary_replay&,
ana::region_model const&)
../../gcc/gcc/analyzer/region-model.cc:5640
0x14723eb ana::program_state::replay_call_summary(ana::call_summary_replay&,
ana::program_state const&)
../../gcc/gcc/analyzer/program-state.cc:1635
0x1458743 ana::call_summary_edge_info::update_state(ana::program_state*,
ana::exploded_edge const*, ana::region_model_context*) const
../../gcc/gcc/analyzer/engine.cc:1633
0x1450d9a ana::exploded_graph::process_node(ana::exploded_node*)
../../gcc/gcc/analyzer/engine.cc:4241
0x145166a ana::exploded_graph::process_worklist()
../../gcc/gcc/analyzer/engine.cc:3516
0x1453c4b ana::impl_run_checkers(ana::logger*)
../../gcc/gcc/analyzer/engine.cc:6210
0x1454bb6 ana::run_checkers()
../../gcc/gcc/analyzer/engine.cc:6308
0x1443a98 execute
../../gcc/gcc/analyzer/analyzer-pass.cc:87
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c++/114858] New: Compilation Hang and Excessive RAM Consumption in GCC

2024-04-25 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114858

Bug ID: 114858
   Summary: Compilation Hang and Excessive RAM Consumption in GCC
   Product: gcc
   Version: 14.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 following code snippet triggers a hang issue:

$ cat bug.cpp

template  void g(F);
template 
auto h(A &&... a) -> decltype(g(0,
(g)(a)...))
{
  h([] {});
}

int main() { 
  h(); 
  return 0; 
}

I observed that when attempting to compile this code using GCC, the compilation
process hangs indefinitely, without providing any output or indicating
successful compilation. Additionally, the RAM usage continuously increases,
leading to excessive consumption of system resources.

However, it is worth noting that when using LLVM as the compiler, the code
compiles quickly and produces the expected compilation output.

We have found that this issue still persists in the latest version of GCC(see
https://godbolt.org/z/P1c7f664f)

The command we used is(no error output):

g++ bug.cpp



The GCC version:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/cTest/gcc/myinstall/libexec/gcc/x86_64-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../configure -v --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --enable-checking=no
--enable-languages=c,c++ --disable-multilib --prefix=/home/cTest/gcc/myinstall
--disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240329 (experimental) (GCC) 


[Bug analyzer/114778] ICE: in get_region_for_local, at analyzer/region.cc:1366

2024-04-22 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114778

--- Comment #3 from Anonymous  ---
(In reply to David Malcolm from comment #1)
> Thanks for filing this.
> 
> It's failing this assertion in frame_region::get_region_for_local :
> 
> 1421  case VAR_DECL:
> 1422gcc_assert (!is_global_var (expr));
> 1423/* Fall through.  */
> 1424  case PARM_DECL:
> 1425  case RESULT_DECL:
> 1426gcc_assert (DECL_CONTEXT (expr) == m_fun.decl);
> 1427break;
> 
> (gdb) pt expr
>   type  size 
> unit-size 
> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
> 0x7fffea664000 precision:64 min  max
> >
> used unsigned ignored DI ../../src/pr114778.c:6:5 size  0x7fffea644f48 64> unit-size 
> align:64 warn_if_not_align:0 context >
> 
> (gdb) p m_fun.decl
> $1 = 
> 
> Looks like another ICE due to GCC's nested functions extension for C, which
> the analyzer doesn't yet support.

Thank you for your answer to this issue!

[Bug analyzer/114798] New: ICE: in convert_svalue_from_summary_1, at analyzer/call-summary.cc:290

2024-04-21 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114798

Bug ID: 114798
   Summary: ICE: in convert_svalue_from_summary_1, at
analyzer/call-summary.cc:290
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/5GE3xG7zM

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202404101100/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202404101100/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202404101100
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240410 (experimental) (GCC) 

git version: 0774240b4df9a9bc48ce33a9625788e402498f5a
***
Program:
$ cat mutant.c
_Bool b() {}
void c() {
  int d;
  void check(_Bool a) {
_Bool e;
if (a && e)
  __builtin_abort();
_Bool f = b(d);
if (a && f)
  __builtin_abort();
  }
  check(1);
  check(0);
}

***
Command Lines:
$ gcc -fanalyzer -fanalyzer-call-summaries -c mutant.c
during IPA pass: analyzer
mutant.c: In function ‘c’:
mutant.c:12:3: internal compiler error: in convert_svalue_from_summary_1, at
analyzer/call-summary.cc:290
   12 |   check(1);
  |   ^~~~
0x933c67 ana::call_summary_replay::convert_svalue_from_summary_1(ana::svalue
const*)
../../gcc/gcc/analyzer/call-summary.cc:290
0x217b2aa ana::call_summary_replay::convert_svalue_from_summary(ana::svalue
const*)
../../gcc/gcc/analyzer/call-summary.cc:236
0x219584b ana::replay_fact_visitor::on_fact(ana::svalue const*, tree_code,
ana::svalue const*)
../../gcc/gcc/analyzer/constraint-manager.cc:3273
0x2189728 ana::constraint_manager::for_each_fact(ana::fact_visitor*) const
../../gcc/gcc/analyzer/constraint-manager.cc:3240
0x2189958
ana::constraint_manager::replay_call_summary(ana::call_summary_replay&,
ana::constraint_manager const&)
../../gcc/gcc/analyzer/constraint-manager.cc:3307
0x1491770 ana::region_model::replay_call_summary(ana::call_summary_replay&,
ana::region_model const&)
../../gcc/gcc/analyzer/region-model.cc:5640
0x14723eb ana::program_state::replay_call_summary(ana::call_summary_replay&,
ana::program_state const&)
../../gcc/gcc/analyzer/program-state.cc:1635
0x1458743 ana::call_summary_edge_info::update_state(ana::program_state*,
ana::exploded_edge const*, ana::region_model_context*) const
../../gcc/gcc/analyzer/engine.cc:1633
0x1450d9a ana::exploded_graph::process_node(ana::exploded_node*)
../../gcc/gcc/analyzer/engine.cc:4241
0x145166a ana::exploded_graph::process_worklist()
../../gcc/gcc/analyzer/engine.cc:3516
0x1453c4b ana::impl_run_checkers(ana::logger*)
../../gcc/gcc/analyzer/engine.cc:6210
0x1454bb6 ana::run_checkers()
../../gcc/gcc/analyzer/engine.cc:6308
0x1443a98 execute
../../gcc/gcc/analyzer/analyzer-pass.cc:87
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug analyzer/114778] New: ICE: internal compiler error: in get_region_for_local, at analyzer/region.cc:1366

2024-04-18 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114778

Bug ID: 114778
   Summary: ICE: internal compiler error: in get_region_for_local,
at analyzer/region.cc:1366
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: analyzer
  Assignee: dmalcolm at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/r3E89h944

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202404101100/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202404101100/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202404101100
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240410 (experimental) (GCC) 

git version: 0774240b4df9a9bc48ce33a9625788e402498f5a
***
Program:
$ cat mutant.c
int b;
int a(char *c) { return c[9]; }
void d() {
  struct e {
char g[b]
  } f(struct e arg) {
a(arg.g);
  }
  if (f != 'd')
;
}

***
Command Lines:
$ gcc -fanalyzer -c mutant.c
mutant.c: In function ‘d’:
mutant.c:6:3: warning: no semicolon at end of struct or union
6 |   } f(struct e arg) {
  |   ^
mutant.c:9:9: warning: comparison between pointer and integer
9 |   if (f != 'd')
  | ^~
during IPA pass: analyzer
mutant.c: In function ‘a’:
mutant.c:2:26: internal compiler error: in get_region_for_local, at
analyzer/region.cc:1366
2 | int a(char *c) { return c[9]; }
  | ~^~~
0x88c303 ana::frame_region::get_region_for_local(ana::region_model_manager*,
tree_node*, ana::region_model_context const*) const
../../gcc/gcc/analyzer/region.cc:1366
0x14815a2 ana::region_model::get_lvalue(ana::path_var,
ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:2466
0x148541a ana::region_model::get_rvalue_1(ana::path_var,
ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:2532
0x1481ccc ana::region_model::get_rvalue(ana::path_var,
ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:2610
0x2173639 ana::region_model::check_region_bounds(ana::region const*,
ana::access_direction, ana::svalue const*, ana::region_model_context*) const
../../gcc/gcc/analyzer/bounds-checking.cc:1396
0x147f3c9 ana::region_model::check_region_access(ana::region const*,
ana::access_direction, ana::svalue const*, ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:3095
0x147f3c9 ana::region_model::check_region_access(ana::region const*,
ana::access_direction, ana::svalue const*, ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:3084
0x147f3c9 ana::region_model::check_region_for_read(ana::region const*,
ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:3129
0x147f3c9 ana::region_model::check_region_for_read(ana::region const*,
ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:3126
0x147f3c9 ana::region_model::get_store_value(ana::region const*,
ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:2690
0x1481ccc ana::region_model::get_rvalue(ana::path_var,
ana::region_model_context*) const
../../gcc/gcc/analyzer/region-model.cc:2610
0x148664c ana::region_model::on_assignment(gassign const*,
ana::region_model_context*)
../../gcc/gcc/analyzer/region-model.cc:1244
0x144daf0 ana::exploded_node::on_stmt(ana::exploded_graph&, ana::supernode
const*, gimple const*, ana::program_state*, ana::uncertainty_t*, bool*,
ana::path_context*)
../../gcc/gcc/analyzer/engine.cc:1515
0x1450915 ana::exploded_graph::process_node(ana::exploded_node*)
../../gcc/gcc/analyzer/engine.cc:4125
0x145166a ana::exploded_graph::process_worklist()
../../gcc/gcc/analyzer/engine.cc:3516
0x1453c4b ana::impl_run_checkers(ana::logger*)
../../gcc/gcc/analyzer/engine.cc:6210
0x1454bb6 ana::run_checkers()
../../gcc/gcc/analyzer/engine.cc:6308
0x1443a98 execute
../../gcc/gcc/analyzer/analyzer-pass.cc:87
Please submit a full bug report, with preprocessed source (by using
-freport-bug).

[Bug sanitizer/114687] New: ICE: in edge_before_returns_twice_call, at gimple-iterator.cc:981

2024-04-10 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114687

Bug ID: 114687
   Summary: ICE: in edge_before_returns_twice_call, at
gimple-iterator.cc:981
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/vPM1Gshzx

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202404101100/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202404101100/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202404101100
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240410 (experimental) (GCC) 

git version: 0774240b4df9a9bc48ce33a9625788e402498f5a
***
Program:
$ cat mutant.c
int a;
int b(int);
__attribute__((pure, returns_twice)) int c() {
  a = 1;
  while (a)
a = 2;
  return a;
}
int e(void) {
  int d = c();
  b(d);
}

***
Command Lines:
$ gcc -fsanitize=address -O1 -c mutant.c
during GIMPLE pass: asan
mutant.c: In function ‘e’:
mutant.c:9:5: internal compiler error: in edge_before_returns_twice_call, at
gimple-iterator.cc:981
9 | int e(void) {
  | ^
0x792bf8 edge_before_returns_twice_call
../../gcc/gcc/gimple-iterator.cc:981
0xcb169e gsi_safe_insert_before(gimple_stmt_iterator*, gimple*)
../../gcc/gcc/gimple-iterator.cc:1054
0x1060c36 maybe_instrument_call
../../gcc/gcc/asan.cc:3032
0x1060c36 transform_statements
../../gcc/gcc/asan.cc:3118
0x1060fe7 asan_instrument
../../gcc/gcc/asan.cc:4262
0x1060fe7 execute
../../gcc/gcc/asan.cc:4303
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c++/114638] New: Hang and Memory Consumption Increase during Compilation with Recursive Template Instantiation

2024-04-08 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114638

Bug ID: 114638
   Summary: Hang and Memory Consumption Increase during
Compilation with Recursive Template Instantiation
   Product: gcc
   Version: 14.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 following code snippet triggers a hang issue:

$ cat bug.cpp

struct Z
{
  Z () = default;
  Z (Z const &) = default;
  constexpr Z (Z &&) {}
};

template < typename T > 
constexpr int 
fn (T v)
{
  return fn (v);
}

auto t = fn (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z
(Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z
(Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z (Z ());


The code with this syntax error should promptly output a compilation error
instead of hanging indefinitely and depleting memory resources. The command we
used is(no error output):

g++ bug.cpp



The GCC version:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/cTest/gcc/myinstall/libexec/gcc/x86_64-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../configure -v --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --enable-checking=no
--enable-languages=c,c++ --disable-multilib --prefix=/home/cTest/gcc/myinstall
--disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240329 (experimental) (GCC) 


[Bug c/114634] New: Crash Issue Encountered in GCC Compilation of Template Code with Aligned Attribute

2024-04-08 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114634

Bug ID: 114634
   Summary: Crash Issue Encountered in GCC Compilation of Template
Code with Aligned Attribute
   Product: gcc
   Version: 14.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 following code snippet triggers a crash issue:


$ cat bug.cc

template  class A
{ enum { e __attribute__ ((aligned(16))) }; };



The error output is:

$ gcc bug.cc

internal compiler error: Segmentation fault
2 | { enum { e __attribute__ ((aligned(16))) }; };
  |^
0xedc273 crash_signal
../../gcc/toplev.cc:319
0x957dd7 diag_attr_exclusions
../../gcc/attribs.cc:471
0x95a5f7 decl_attributes(tree_node**, tree_node*, int, tree_node*)
../../gcc/attribs.cc:867
0x7ecc0e cplus_decl_attributes(tree_node**, tree_node*, int)
../../gcc/cp/decl2.cc:1880
0x7de1d1 build_enumerator(tree_node*, tree_node*, tree_node*, tree_node*,
unsigned int)
../../gcc/cp/decl.cc:17543
0x890bdc cp_parser_enumerator_definition
../../gcc/cp/parser.cc:21903
0x890bdc cp_parser_enumerator_list
../../gcc/cp/parser.cc:21823
0x890bdc cp_parser_enum_specifier
../../gcc/cp/parser.cc:21754
0x890bdc cp_parser_type_specifier
../../gcc/cp/parser.cc:20034
0x8916f1 cp_parser_decl_specifier_seq
../../gcc/cp/parser.cc:16590
0x8bfc4f cp_parser_member_declaration
../../gcc/cp/parser.cc:27984
0x88dec1 cp_parser_member_specification_opt
../../gcc/cp/parser.cc:27840
0x88dec1 cp_parser_class_specifier
../../gcc/cp/parser.cc:26845
0x890171 cp_parser_type_specifier
../../gcc/cp/parser.cc:20064
0x8916f1 cp_parser_decl_specifier_seq
../../gcc/cp/parser.cc:16590
0x8bd774 cp_parser_single_declaration
../../gcc/cp/parser.cc:33143
0x8bdbd3 cp_parser_template_declaration_after_parameters
../../gcc/cp/parser.cc:32799
0x8be4b9 cp_parser_explicit_template_declaration
../../gcc/cp/parser.cc:33072
0x8be4b9 cp_parser_template_declaration_after_export
../../gcc/cp/parser.cc:33091
0x8c1fad cp_parser_declaration
../../gcc/cp/parser.cc:15502


The GCC version:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/cTest/gcc/myinstall/libexec/gcc/x86_64-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../configure -v --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --enable-checking=no
--enable-languages=c,c++ --disable-multilib --prefix=/home/cTest/gcc/myinstall
--disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240329 (experimental) (GCC) 


[Bug tree-optimization/114095] New: ICE: in build2, at tree.cc:5097

2024-02-25 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114095

Bug ID: 114095
   Summary: ICE: in build2, at tree.cc:5097
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/c4d5x6Eza

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/2024020020942/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/2024020020942/libexec/gcc/x86_64-pc-linux-gnu/14.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/2024020020942
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.1 20240204 (experimental) (GCC)

git version: 8e6ebacc9e3cee0d2053fdaceda0ae052e34b777
***
Program:
$ cat mutant.c
__GIMPLE a(double *x) {
  b c;
  d = x_80 + c

***
Command Lines:
$ gcc mutant.c
mutant.c:1:1: error: ‘__GIMPLE’ only valid with ‘-fgimple’
1 | __GIMPLE a(double *x) {
  | ^~~~
mutant.c:1:10: error: return type defaults to ‘int’ [-Wimplicit-int]
1 | __GIMPLE a(double *x) {
  |  ^
mutant.c: In function ‘a’:
mutant.c:2:3: error: unknown type name ‘b’
2 |   b c;
  |   ^
mutant.c:3:3: error: ‘d’ undeclared (first use in this function)
3 |   d = x_80 + c
  |   ^
mutant.c:3:3: note: each undeclared identifier is reported only once for each
function it appears in
mutant.c:3:3: internal compiler error: in build2, at tree.cc:5097
0x869763 build2(tree_code, tree_node*, tree_node*, tree_node*)
../../gcc/gcc/tree.cc:5097
0x9f960f build2_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
../../gcc/gcc/tree.h:4750
0x9f960f c_parser_gimple_binary_expression
../../gcc/gcc/c/gimple-parser.cc:1068
0x9fa561 c_parser_gimple_statement
../../gcc/gcc/c/gimple-parser.cc:878
0x9fb2aa c_parser_gimple_compound_statement
../../gcc/gcc/c/gimple-parser.cc:669
0x9fcca1 c_parser_parse_gimple_body(c_parser*, char*, c_declspec_il,
profile_count)
../../gcc/gcc/c/gimple-parser.cc:253
0x9e8cd4 c_parser_declaration_or_fndef
../../gcc/gcc/c/c-parser.cc:3011
0x9f2f3b c_parser_external_declaration
../../gcc/gcc/c/c-parser.cc:2046
0x9f3925 c_parser_translation_unit
../../gcc/gcc/c/c-parser.cc:1900
0x9f3925 c_parse_file()
../../gcc/gcc/c/c-parser.cc:26815
0xa6ad51 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.cc:1306
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/110251] [13/14 Regression] Hang at -O3 on x86_64-linux-gnu

2024-01-16 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110251

--- Comment #15 from Anonymous  ---
(In reply to Andrew Pinski from comment #10)
> (In reply to Anonymous from comment #9)
> > (In reply to Andrew Pinski from comment #1)
> > > dom3 :
> > > ```
> > 
> > Could you please explain on how you to record this trace? Is there any
> > specific compilation option to enable this information? Thanks.
> 
> I used gdb to figure it out. Just stopped it a few times during the
> compiling and saw the backtrace was similar/stuck.

Got it. Thanks.

[Bug tree-optimization/110251] [13/14 Regression] Hang at -O3 on x86_64-linux-gnu

2024-01-16 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110251

Anonymous  changed:

   What|Removed |Added

 CC||iamanonymous.cs at gmail dot 
com

--- Comment #9 from Anonymous  ---
(In reply to Andrew Pinski from comment #1)
> dom3 :
> ```
> #0  0x012add4b in irange::intersect (this=, v=...) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/value-range.cc:1523
> #1  0x01c93506 in Value_Range::intersect (r=...,
> this=0x7ffe17a0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/value-range.h:541
> #2  gori_compute::compute_operand2_range (this=0x2f4dcd0, r=...,
> handler=..., lhs=..., name=0x779dc000, src=..., rel=) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1267
> #3  0x01c946de in gori_compute::compute_operand1_and_operand2_range
> (this=0x2f4dcd0, r=..., handler=..., lhs=..., name=0x779dc000, src=...,
> rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1296
> #4  0x01c9165b in gori_compute::compute_operand_range
> (this=0x2f4dcd0, r=..., stmt=0x776015d8, lhs=..., name=0x779dc000,
> src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:708
> #5  0x01c94028 in gori_compute::compute_operand_range (rel=0x0,
> src=..., name=0x779dc000, lhs=..., stmt=, r=...,
> this=0x2f4dcd0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/value-range.h:757
> #6  gori_compute::compute_operand1_range (this=0x2f4dcd0, r=...,
> handler=..., lhs=..., name=0x779dc000, src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1178
> #7  0x01c9159b in gori_compute::compute_operand_range
> (this=0x2f4dcd0, r=..., stmt=0x77601688, lhs=..., name=0x779dc000,
> src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:711
> #8  0x01c94028 in gori_compute::compute_operand_range (rel=0x0,
> src=..., name=0x779dc000, lhs=..., stmt=, r=...,
> this=0x2f4dcd0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/value-range.h:757
> #9  gori_compute::compute_operand1_range (this=0x2f4dcd0, r=...,
> handler=..., lhs=..., name=0x779dc000, src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1178
> #10 0x01c94757 in gori_compute::compute_operand1_and_operand2_range
> (this=0x2f4dcd0, r=..., handler=..., lhs=..., name=, src=...,
> rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1300
> #11 0x01c9165b in gori_compute::compute_operand_range
> (this=0x2f4dcd0, r=..., stmt=0x776016e0, lhs=..., name=0x779dc000,
> src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:708
> #12 0x01c94028 in gori_compute::compute_operand_range (rel=0x0,
> src=..., name=0x779dc000, lhs=..., stmt=, r=...,
> this=0x2f4dcd0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/value-range.h:757
> #13 gori_compute::compute_operand1_range (this=0x2f4dcd0, r=...,
> handler=..., lhs=..., name=0x779dc000, src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1178
> #14 0x01c9159b in gori_compute::compute_operand_range
> (this=0x2f4dcd0, r=..., stmt=0x77601790, lhs=..., name=0x779dc000,
> src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:711
> #15 0x01c94028 in gori_compute::compute_operand_range (rel=0x0,
> src=..., name=0x779dc000, lhs=..., stmt=, r=...,
> this=0x2f4dcd0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/value-range.h:757
> #16 gori_compute::compute_operand1_range (this=0x2f4dcd0, r=...,
> handler=..., lhs=..., name=0x779dc000, src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1178
> #17 0x01c94757 in gori_compute::compute_operand1_and_operand2_range
> (this=0x2f4dcd0, r=..., handler=..., lhs=..., name=, src=...,
> rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1300
> #18 0x01c9165b in gori_compute::compute_operand_range
> (this=0x2f4dcd0, r=..., stmt=0x776017e8, lhs=..., name=0x779dc000,
> src=..., rel=0x0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:708
> #19 0x01c93552 in gori_compute::compute_operand_range (rel=0x0,
> src=..., name=0x779dc000, lhs=..., stmt=, r=...,
> this=0x2f4dcd0) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/value-range.h:757
> #20 gori_compute::compute_operand2_range (this=0x2f4dcd0, r=...,
> handler=..., lhs=..., name=0x779dc000, src=..., rel=) at
> /home/apinski/src/upstream-gcc-git/gcc/gcc/gimple-range-gori.cc:1276
> #21 0x01c946de in gori_compute::compute_operand1_and_operand2_range
> (this=0x2f4dcd0, r=..., handler=..., lhs=..., name=0x779dc000, src=...,
> rel=0x0) at
> 

[Bug tree-optimization/113285] New: ICE: verify_flow_info failed

2024-01-08 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113285

Bug ID: 113285
   Summary: ICE: verify_flow_info failed
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/8Ebhao48a

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
void f(void)
{
  void p(void)
  {
__label__ l1;
void q(void)
{
  goto l1;
}

l1:;
  }
  p();
}

***
Command Lines:
$ gcc mutant.c
mutant.c: In function ‘p’:
mutant.c:3:8: error: label ‘({anonymous})’ has incorrect context in bb 4
3 |   void p(void)
  |^
during GIMPLE pass: cfg
mutant.c:3:8: internal compiler error: verify_flow_info failed
0xae444e verify_flow_info()
../../gcc/gcc/cfghooks.cc:287
0x1066aac checking_verify_flow_info()
../../gcc/gcc/cfghooks.h:214
0x1066aac cleanup_tree_cfg_noloop
../../gcc/gcc/tree-cfgcleanup.cc:1154
0x1066aac cleanup_tree_cfg(unsigned int)
../../gcc/gcc/tree-cfgcleanup.cc:1205
0x105e6f4 execute_build_cfg
../../gcc/gcc/tree-cfg.cc:378
0x105e6f4 execute
../../gcc/gcc/tree-cfg.cc:412
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug middle-end/113264] New: ICE:tree check: expected tree that contains 'common' structure, have 'integer_cst' in copy_list, at tree.cc:1427

2024-01-07 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113264

Bug ID: 113264
   Summary: ICE:tree check: expected tree that contains 'common'
structure, have 'integer_cst' in copy_list, at
tree.cc:1427
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: middle-end
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/1bev4r9a4

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
__attribute__((no_sanitize_address))
__attribute__((target_clones("arch=haswell", "default"))) int __tanh() {}
__typeof(__tanh) tanhf64 __attribute__((alias("__tanh")))
__attribute__((__copy__(__tanh)));

***
Command Lines:
$ gcc mutant.c
mutant.c:4:1: internal compiler error: tree check: expected tree that contains
‘common’ structure, have ‘integer_cst’ in copy_list, at tree.cc:1427
4 | __attribute__((__copy__(__tanh)));
  | ^
0x859d06 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
../../gcc/gcc/tree.cc:9126
0x860f78 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/gcc/tree.h:3748
0x860f78 copy_list(tree_node*)
../../gcc/gcc/tree.cc:1427
0xa755a5 handle_copy_attribute
../../gcc/gcc/c-family/c-attribs.cc:3077
0x94ad5b decl_attributes(tree_node**, tree_node*, int, tree_node*)
../../gcc/gcc/attribs.cc:886
0x95139d c_decl_attributes
../../gcc/gcc/c/c-decl.cc:5425
0x9689f7 start_decl(c_declarator*, c_declspecs*, bool, tree_node*, bool,
unsigned int*)
../../gcc/gcc/c/c-decl.cc:5571
0x9d5757 c_parser_declaration_or_fndef
../../gcc/gcc/c/c-parser.cc:2766
0x9e168b c_parser_external_declaration
../../gcc/gcc/c/c-parser.cc:2046
0x9e2075 c_parser_translation_unit
../../gcc/gcc/c/c-parser.cc:1900
0x9e2075 c_parse_file()
../../gcc/gcc/c/c-parser.cc:26713
0xa564e1 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.cc:1296
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug debug/113057] New: Segmentation fault in dwarf2out.cc:941 with -O -fno-dwarf2-cfi-asm

2023-12-17 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113057

Bug ID: 113057
   Summary: Segmentation fault in dwarf2out.cc:941 with -O
-fno-dwarf2-cfi-asm
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/4ndYafjnT

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
int __RTL (startwith ("final")) a () {
(function "" ) 
}

***
Command Lines:
$ gcc -O -fno-dwarf2-cfi-asm mutant.c
mutant.c:3:1: internal compiler error: Segmentation fault
3 | }
  | ^
0x101491f crash_signal
../../gcc/gcc/toplev.cc:316
0xb6efb7 vec::iterate(unsigned int,
dw_cfi_node**) const
../../gcc/gcc/vec.h:951
0xb6efb7 output_call_frame_info
../../gcc/gcc/dwarf2out.cc:941
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug target/113043] New: ICE: in emit_move_insn, at expr.cc:4246

2023-12-15 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113043

Bug ID: 113043
   Summary: ICE: in emit_move_insn, at expr.cc:4246
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/erY5Mrrso

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
struct a {
  long b
};
__attribute__((interrupt)) void c(struct a *d) { 1 != d->b; }

***
Command Lines:
$ gcc -mx32 -mgeneral-regs-only -maddress-mode=long -fsanitize=undefined
mutant.c
mutant.c:3:1: warning: no semicolon at end of struct or union
3 | };
  | ^
during RTL pass: expand
mutant.c: In function ‘c’:
mutant.c:4:56: internal compiler error: in emit_move_insn, at expr.cc:4246
4 | __attribute__((interrupt)) void c(struct a *d) { 1 != d->b; }
  |   ~^~~
0x774d50 emit_move_insn(rtx_def*, rtx_def*)
../../gcc/gcc/expr.cc:4246
0xaddfec expand_gimple_stmt_1
../../gcc/gcc/cfgexpand.cc:4011
0xaddfec expand_gimple_stmt
../../gcc/gcc/cfgexpand.cc:4045
0xadec97 expand_gimple_basic_block
../../gcc/gcc/cfgexpand.cc:6101
0xae08f6 execute
../../gcc/gcc/cfgexpand.cc:6836
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/112939] New: ICE: verify_ssa failed with -O -ftrivial-auto-var-init=zero

2023-12-09 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112939

Bug ID: 112939
   Summary: ICE: verify_ssa failed with -O
-ftrivial-auto-var-init=zero
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/4q74n5baY

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
int i;

void f (void)
{
  for (;;)
  {
if (0)
  for (;;)
  {
int *a;
int *b = a;

 l1:
*b = (*b != 0) ? 0 : 2;
  }

if (i != 0)
  goto l1;
  }
}

***
Command Lines:
$ gcc -O -ftrivial-auto-var-init=zero mutant.c
mutant.c: In function ‘f’:
mutant.c:20:1: error: definition in block 5 does not dominate use in block 3
   20 | }
  | ^
for SSA_NAME: a_11 in statement:
# VUSE <.MEM_5>
_1 = *a_11;
during GIMPLE pass: fre
mutant.c:20:1: internal compiler error: verify_ssa failed
0x1283220 verify_ssa(bool, bool)
../../gcc/gcc/tree-ssa.cc:1203
0xee93a5 execute_function_todo
../../gcc/gcc/passes.cc:2095
0xee980e execute_todo
../../gcc/gcc/passes.cc:2142
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug target/112913] New: ICE: in curr_insn_transform, at lra-constraints.cc:4308

2023-12-07 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112913

Bug ID: 112913
   Summary: ICE: in curr_insn_transform, at
lra-constraints.cc:4308
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
typedef unsigned short uint16_t;
uint16_t a;

void
function (uint16_t **p)
{
  a = **p;
}

***
Compiler explorer: 
Command Lines:
$ gcc -ffixed-rax -ffixed-rbx -ffixed-rcx -ffixed-rdx -ffixed-rdi -ffixed-rsi
-ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12 -ffixed-r13
-ffixed-r14 -fsanitize=address mutant.c
mutant.c: In function ‘function’:
mutant.c:8:1: error: unable to generate reloads for:
8 | }
  | ^
(insn 31 30 32 4 (set (reg:CCGC 17 flags)
(compare:CCGC (reg:QI 113 [ _21 ])
(reg:QI 109 [ _17 ]))) "mutant.c":7:7 9 {*cmpqi_1}
 (expr_list:REG_DEAD (reg:QI 113 [ _21 ])
(expr_list:REG_DEAD (reg:QI 109 [ _17 ])
(nil
during RTL pass: reload
mutant.c:8:1: internal compiler error: in curr_insn_transform, at
lra-constraints.cc:4308
0x7e504e _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
../../gcc/gcc/rtl-error.cc:108
0x7bb7f8 curr_insn_transform
../../gcc/gcc/lra-constraints.cc:4308
0xe32206 lra_constraints(bool)
../../gcc/gcc/lra-constraints.cc:5511
0xe1d532 lra(_IO_FILE*)
../../gcc/gcc/lra.cc:2419
0xdd3241 do_reload
../../gcc/gcc/ira.cc:5973
0xdd3241 execute
../../gcc/gcc/ira.cc:6161
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

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

[Bug target/112903] New: ICE: in df_scan_verify, at df-scan.cc:4239 with -O -fdump-rtl-pro_and_epilogue

2023-12-07 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112903

Bug ID: 112903
   Summary: ICE: in df_scan_verify, at df-scan.cc:4239 with -O
-fdump-rtl-pro_and_epilogue
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
int __RTL (startwith ("pro_and_epilogue")) a ()
{
(function ""
  (insn-chain
(block 2
  (edge-from b )
  (cnote 6 [bb 2] NOTE_INSN_BASIC_BLOCK)
  (cjump_insn 0 (set (pc)
(if_then_else (ge (reg flags)
(const_int 0))
(label_ref 16)
(pc))) )
) (block 3
  (cnote 1 [bb 3] NOTE_INSN_BASIC_BLOCK)
  (cjump_insn 9 (set (pc)
(label_ref 20)) )
) (block 4
  (edge-from 2)
  (clabel 16 2)
  (cnote 7 [bb 4] NOTE_INSN_BASIC_BLOCK)
) (block 5
  (edge-from 4 (flags "FALLTHRU"))
  (edge-from 3)
  (clabel 20 3)
  (cnote 21 [bb 5] NOTE_INSN_BASIC_BLOCK)
  (edge-to exit (flags "FALLTHRU"))
) ) )  
}

***
Command Lines:
$ gcc -O -fdump-rtl-pro_and_epilogue mutant.c
during RTL pass: dse2
mutant.c: In function ‘a’:
mutant.c:28:1: internal compiler error: in df_scan_verify, at df-scan.cc:4239
   28 | }
  | ^
0x76308c df_scan_verify()
../../gcc/gcc/df-scan.cc:4239
0xb3d8f4 df_verify()
../../gcc/gcc/df-core.cc:1834
0xb3d8f4 df_analyze_1
../../gcc/gcc/df-core.cc:1221
0x1dfbc79 rest_of_handle_dse
../../gcc/gcc/dse.cc:3711
0x1dfbc79 execute
../../gcc/gcc/dse.cc:3787
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.


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

[Bug tree-optimization/112898] New: ICE: in make_ssa_name_fn, at tree-ssanames.cc:354 with -O2 -finstrument-functions-once

2023-12-07 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112898

Bug ID: 112898
   Summary: ICE: in make_ssa_name_fn, at tree-ssanames.cc:354 with
-O2 -finstrument-functions-once
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
void func(int n)
{
struct T { int x[n]; };
struct T *t = __builtin_malloc(sizeof *t);
}

***
Command Lines:
$ gcc -O2 -finstrument-functions-once mutant.c
during GIMPLE pass: fnsplit
In function ‘func.part.0’:
cc1: internal compiler error: in make_ssa_name_fn, at tree-ssanames.cc:354
0x848332 make_ssa_name_fn(function*, tree_node*, gimple*, unsigned int)
../../gcc/gcc/tree-ssanames.cc:354
0x109c94b make_ssa_name(tree_node*, gimple*)
../../gcc/gcc/tree-ssanames.h:98
0x109c94b remap_ssa_name
../../gcc/gcc/tree-inline.cc:237
0x10a0462 copy_tree_body_r(tree_node**, int*, void*)
../../gcc/gcc/tree-inline.cc:1226
0x1343f4c walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
../../gcc/gcc/tree.cc:11420
0x13440a4 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set >*))
../../gcc/gcc/tree.cc:11654
0x109ad43 remap_type_1
../../gcc/gcc/tree-inline.cc:596
0x109b6c3 remap_type(tree_node*, copy_body_data*)
../../gcc/gcc/tree-inline.cc:713
0x109b805 remap_decl(tree_node*, copy_body_data*)
../../gcc/gcc/tree-inline.cc:377
0x109af15 remap_type_1
../../gcc/gcc/tree-inline.cc:562
0x109b6c3 remap_type(tree_node*, copy_body_data*)
../../gcc/gcc/tree-inline.cc:713
0x109b805 remap_decl(tree_node*, copy_body_data*)
../../gcc/gcc/tree-inline.cc:377
0x109daf4 remap_decls
../../gcc/gcc/tree-inline.cc:762
0x109de54 remap_block
../../gcc/gcc/tree-inline.cc:820
0x109df25 remap_blocks
../../gcc/gcc/tree-inline.cc:839
0x10a5e1b tree_function_versioning(tree_node*, tree_node*,
vec*, ipa_param_adjustments*, bool,
bitmap_head*, basic_block_def*)
../../gcc/gcc/tree-inline.cc:6310
0xb27bfe cgraph_node::create_version_clone_with_body(vec, vec*, ipa_param_adjustments*,
bitmap_head*, basic_block_def*, char const*, tree_node*, bool)
../../gcc/gcc/cgraphclones.cc:1073
0x1ef4f48 split_function
../../gcc/gcc/ipa-split.cc:1376
0x1ef8f62 execute_split_functions
../../gcc/gcc/ipa-split.cc:1886
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

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

[Bug debug/112878] New: ICE: in ctf_add_slice, at ctfc.cc:499 with -std=c23 -gctf1

2023-12-06 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112878

Bug ID: 112878
   Summary: ICE: in ctf_add_slice, at ctfc.cc:499 with -std=c23
-gctf1
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
struct {
  _BitInt(282) a : 280;
} b;

***
Command Lines:
$ gcc -std=c23 -gctf1 mutant.c
mutant.c:3:1: internal compiler error: in ctf_add_slice, at ctfc.cc:499
3 | } b;
  | ^
0x8d0e95 ctf_add_slice(ctf_container*, unsigned int, unsigned long, unsigned
int, unsigned int, die_struct*)
../../gcc/gcc/ctfc.cc:499
0xb6a770 gen_ctf_sou_type
../../gcc/gcc/dwarf2ctf.cc:617
0xb69fb7 gen_ctf_type
../../gcc/gcc/dwarf2ctf.cc:892
0xb6aa61 ctf_do_die(die_struct*)
../../gcc/gcc/dwarf2ctf.cc:978
0xbbc62b ctf_debug_do_cu
../../gcc/gcc/dwarf2out.cc:32985
0xbbc62b ctf_debug_do_cu
../../gcc/gcc/dwarf2out.cc:32978
0xbbc62b dwarf2out_early_finish
../../gcc/gcc/dwarf2out.cc:33114
0xb2411f symbol_table::finalize_compilation_unit()
../../gcc/gcc/cgraphunit.cc:2578
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

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

[Bug debug/112875] New: ICE: in lra_eliminate_regs_1, at lra-eliminations.cc:670 with -Oz -frounding-math -fno-dce -fno-trapping-math -fno-tree-dce -fno-tree-dse -g

2023-12-05 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112875

Bug ID: 112875
   Summary: ICE: in lra_eliminate_regs_1, at
lra-eliminations.cc:670 with -Oz -frounding-math
-fno-dce -fno-trapping-math -fno-tree-dce
-fno-tree-dse -g
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
long a, f;
int b, c, d, g, h, i, j;
char e;
void k(long, int l, char t) {
  char m = b, n = g, o = 0;
  int p, q, r = h;
  long s = g;
  if (f) {
q = t + (float)16777217;
o = ~0;
  }
  if (e) {
d = g + a;
if (d % (a % l)) {
  p = d;
  n = b;
}
if (l) {
  i = b;
  r = a;
  p = h;
}
if (s)
  s = q;
c = f;
e += t;
a = p;
  }
  j = r % n;
  s += g / 0xc000 + !o;
}

***
Compiler explorer: 
Command Lines:
$ gcc -Oz -frounding-math -fno-dce -fno-trapping-math -fno-tree-dce
-fno-tree-dse -g mutant.c
during RTL pass: reload
mutant.c: In function ‘k’:
mutant.c:31:1: internal compiler error: in lra_eliminate_regs_1, at
lra-eliminations.cc:670
   31 | }
  | ^
0x7bbb24 lra_eliminate_regs_1(rtx_insn*, rtx_def*, machine_mode, bool, bool,
poly_int<1u, long>, bool)
../../gcc/gcc/lra-eliminations.cc:670
0xe38f0e lra_eliminate_regs_1(rtx_insn*, rtx_def*, machine_mode, bool, bool,
poly_int<1u, long>, bool)
../../gcc/gcc/lra-eliminations.cc:446
0xe38c08 lra_eliminate_regs_1(rtx_insn*, rtx_def*, machine_mode, bool, bool,
poly_int<1u, long>, bool)
../../gcc/gcc/lra-eliminations.cc:613
0xe396c4 eliminate_regs_in_insn(rtx_insn*, bool, bool, poly_int<1u, long>)
../../gcc/gcc/lra-eliminations.cc:1046
0xe3a029 process_insn_for_elimination
../../gcc/gcc/lra-eliminations.cc:1375
0xe3a029 lra_eliminate(bool, bool)
../../gcc/gcc/lra-eliminations.cc:1473
0xe1d759 lra(_IO_FILE*)
../../gcc/gcc/lra.cc:2553
0xdd3241 do_reload
../../gcc/gcc/ira.cc:5973
0xdd3241 execute
../../gcc/gcc/ira.cc:6161
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

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

[Bug target/112860] New: ICE: in expand_expr_real_2, at expr.cc:10620 with -O0 -fgimple -mavx512f

2023-12-05 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112860

Bug ID: 112860
   Summary: ICE: in expand_expr_real_2, at expr.cc:10620 with -O0
-fgimple -mavx512f
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
typedef _Bool sbool1 __attribute__((signed_bool_precision(1)));
typedef int v16si __attribute__((vector_size(64)));
typedef v16si v16sim __attribute__((vector_mask));
typedef long v16di __attribute__((vector_size(128)));

void __GIMPLE (ssa,guessed_local(118111600),startwith("slp"))
bar (int * restrict a, int * restrict d, int * restrict e)
{
  int * vectp_14;
  v16si * vectp_e_13;
  v16si vect_iftmp_12;
  v16sim mask__75_11;
  v16sim mask__74_10;
  v16si vect__6_9;
  v16si vect__1_8;
  int * vectp_7;
  v16si * vectp_a_6;
  int _2;
  int _5;
  int _7;
  int _9;
  int _11;
  int _13;
  int _15;
  int _17;
  _Bool _41;
  _Bool _49;
  _Bool _53;
  _Bool _57;
  _Bool _61;
  _Bool _65;
  _Bool _69;
  _Bool _73;
  sbool1 _135;
  sbool1 _136;
  sbool1 _137;
  sbool1 _138;
  sbool1 _139;
  sbool1 _140;
  sbool1 _141;
  sbool1 _142;
  sbool1 _143;
  sbool1 _144;
  sbool1 _145;
  sbool1 _146;
  sbool1 _147;
  sbool1 _148;
  sbool1 _149;
  sbool1 _150;
  v16sim _151;

  __BB(2,guessed_local(105119324)):
  _2 = __MEM  (d_26(D) + _Literal (int * restrict) 32);
  _73 = _2 != 0;
  _5 = __MEM  (d_26(D) + _Literal (int * restrict) 36);
  _69 = _5 != 0;
  _7 = __MEM  (d_26(D));
  _65 = _7 != 0;
  _9 = __MEM  (d_26(D) + _Literal (int * restrict) 4);
  _61 = _9 != 0;
  _11 = __MEM  (d_26(D) + _Literal (int * restrict) 48);
  _57 = _11 != 0;
  _13 = __MEM  (d_26(D) + _Literal (int * restrict) 52);
  _53 = _13 != 0;
  _15 = __MEM  (d_26(D) + _Literal (int * restrict) 16);
  _41 = _15 != 0;
  _17 = __MEM  (d_26(D) + _Literal (int * restrict) 60);
  _49 = _17 != 0;
  _135 = _49 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _136 = _41 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _137 = _53 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _138 = _57 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _139 = _61 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _140 = _65 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _141 = _69 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _142 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _143 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _144 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _145 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _146 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _147 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _148 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _149 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _150 = _73 ? _Literal (sbool1) -1 : _Literal (sbool1) 0;
  _151 = _Literal (v16sim) {_150, _149, _148, _147, _146, _145, _144, _143,
_142, _141, _140, _139, _138, _137, _136, _135};
  vect__1_8_154 = __MEM  ((int * restrict)a_22(D));
  vect_iftmp_12_158 = _151 ? vect__6_9_154 : _Literal (v16si) { 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  __MEM  ((int * restrict)e_23(D)) = vect_iftmp_12_158;
  return;
}

***
Compiler explorer: 
Command Lines:
$ gcc -O0 -fgimple -mavx512f mutant.c
during RTL pass: expand
mutant.c: In function ‘bar’:
mutant.c:7:1: internal compiler error: in expand_expr_real_2, at expr.cc:10620
7 | bar (int * restrict a, int * restrict d, int * restrict e)
  | ^~~
0x773215 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
../../gcc/gcc/expr.cc:10620
0xaddfc1 expand_gimple_stmt_1
../../gcc/gcc/cfgexpand.cc:3984
0xaddfc1 expand_gimple_stmt

[Bug target/112845] New: ICE: in extract_insn, at recog.cc:2804 with -Os -fcf-protection -c

2023-12-04 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112845

Bug ID: 112845
   Summary: ICE: in extract_insn, at recog.cc:2804 with -Os
-fcf-protection -c
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311291030/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311291030/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311291030
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231129 (experimental) (GCC) 

git version: 99fa0bfd63d97825c4221dcd3123940f1d0e6291
***
Program:
$ cat mutant.c
#ifdef __x86_64__
#define ENDBR_IMMEDIATE 0xfa1e0ff3
#else
#define ENDBR_IMMEDIATE 0xfb1e0ff3
#endif

int
func (int* p)
{
  return *(p + ENDBR_IMMEDIATE);
}

***
Command Lines:
$ gcc -Os -fcf-protection -c mutant.c
mutant.c: In function ‘func’:
mutant.c:11:1: error: unrecognizable insn:
   11 | }
  | ^
(insn 27 7 28 2 (set (reg:DI 0 ax [101])
(const_int 4196274163 [0xfa1e0ff3])) "mutant.c":10:10 discrim 1 -1
 (nil))
during RTL pass: cprop_hardreg
mutant.c:11:1: internal compiler error: in extract_insn, at recog.cc:2804
0x7e504e _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
../../gcc/gcc/rtl-error.cc:108
0x7e506a _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
../../gcc/gcc/rtl-error.cc:116
0x7e3572 extract_insn(rtx_insn*)
../../gcc/gcc/recog.cc:2804
0xf7209b extract_constrain_insn(rtx_insn*)
../../gcc/gcc/recog.cc:2703
0xf7b182 copyprop_hardreg_forward_1
../../gcc/gcc/regcprop.cc:836
0xf7c389 execute
../../gcc/gcc/regcprop.cc:1423
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

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

[Bug sanitizer/112741] New: ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3261

2023-11-27 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112741

Bug ID: 112741
   Summary: ICE: in gimplify_var_or_parm_decl, at gimplify.cc:3261
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: sanitizer
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at 
gcc dot gnu.org
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311021000/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311021000/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311021000
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231102 (experimental) (GCC)

git version: d508a94167c186b2baacc679896e2809554c0b99
***
Program:
$ cat mutant.c
int __GIMPLE(ssa) foo(int j)
{
  int c[1][10][1];
  int _1;

__BB(2):
  c[0][1][0] = 1;
  c[0][1] = _Literal (int[1]) {};
  _1 = c[0][j_2(D)][0];
  return _1;
}

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

***
Command Lines:
$ gcc -fgimple -fsanitize=undefined mutant.c
during GIMPLE pass: ubsan
mutant.c: In function ‘foo’:
mutant.c:9:20: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.cc:3261
9 |   _1 = c[0][j_2(D)][0];
  |^~~
0x78d031 gimplify_var_or_parm_decl
../../gcc/gcc/gimplify.cc:3261
0xcd5ba0 gimplify_compound_lval
../../gcc/gcc/gimplify.cc:3381
0xccfcd3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16648
0xcd7ef0 gimplify_addr_expr
../../gcc/gcc/gimplify.cc:6788
0xcd0c64 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16743
0xcd0316 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:17001
0xccff17 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:17482
0xccff17 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:17482
0xcf598b force_gimple_operand_1(tree_node*, gimple**, bool (*)(tree_node*),
tree_node*)
../../gcc/gcc/gimplify-me.cc:78
0xcf5abf force_gimple_operand_gsi_1(gimple_stmt_iterator*, tree_node*, bool
(*)(tree_node*), tree_node*, bool, gsi_iterator_update)
../../gcc/gcc/gimplify-me.cc:115
0xcf5abf force_gimple_operand_gsi(gimple_stmt_iterator*, tree_node*, bool,
tree_node*, bool, gsi_iterator_update)
../../gcc/gcc/gimplify-me.cc:141
0x1023f9c instrument_object_size
../../gcc/gcc/ubsan.cc:2306
0x1028f15 execute
../../gcc/gcc/ubsan.cc:2500
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c/112720] New: ICE: Segmentation fault during IPA pass: tmipa

2023-11-26 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112720

Bug ID: 112720
   Summary: ICE: Segmentation fault during IPA pass: tmipa
   Product: gcc
   Version: 14.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: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311021000/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311021000/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311021000
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231102 (experimental) (GCC)

git version: d508a94167c186b2baacc679896e2809554c0b99
***
Program:
$ cat mutant.c
typedef struct S {
  int * val;
  struct S *next;
} s;

s *next;
int a;

static int func(int * val)
{
  int b;
  int * v;
  __transaction_relaxed {
v = next->val;
b = (v == val);
if (b)
  b = 2;
  }
  return b;
}

void test(void *data)
{
  extern void bark(void);
  if (func(0))
bark();
  a = 99;
}

***
Command Lines:
$ gcc -fgnu-tm -c -fsanitize=undefined mutant.c
during IPA pass: tmipa
mutant.c: In function ‘func’:
mutant.c:29:1: internal compiler error: Segmentation fault
   29 | }
  | ^
0xffebdf crash_signal
../../gcc/gcc/toplev.cc:315
0x1004fd0 is_tm_irrevocable
../../gcc/gcc/trans-mem.cc:237
0x100720e ipa_tm_scan_irr_block
../../gcc/gcc/trans-mem.cc:4396
0x100720e ipa_tm_scan_irr_blocks
../../gcc/gcc/trans-mem.cc:4464
0x1007683 ipa_tm_scan_irr_function
../../gcc/gcc/trans-mem.cc:4643
0x1008ae7 ipa_tm_execute
../../gcc/gcc/trans-mem.cc:5526
0x1008ae7 execute
../../gcc/gcc/trans-mem.cc:5686
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug tree-optimization/112709] New: ICE verify_flow_info failed during GIMPLE pass: asan0

2023-11-24 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112709

Bug ID: 112709
   Summary: ICE verify_flow_info failed during GIMPLE pass: asan0
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311021000/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311021000/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311021000
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231102 (experimental) (GCC)

git version: d508a94167c186b2baacc679896e2809554c0b99
***
Program:
$ cat mutant.c
struct S { char c[1024]; };
void func(void);
struct S s(void) __attribute__((returns_twice));
struct S *p;

void func1(void)
{
  func();
  *p = s();
}

***
Command Lines:
$ gcc -fsanitize=address -c mutant.c
mutant.c: In function ‘func1’:
mutant.c:6:6: error: returns_twice call is not first in basic block 4
6 | void func1(void)
  |  ^
*p.0_1(ab) = s ();
during GIMPLE pass: asan0
mutant.c:6:6: internal compiler error: verify_flow_info failed
0xad0a0e verify_flow_info()
../../gcc/gcc/cfghooks.cc:287
0xed36d7 execute_function_todo
../../gcc/gcc/passes.cc:2100
0xed3c0e execute_todo
../../gcc/gcc/passes.cc:2142
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug target/112695] New: ICE: in gen_reg_rtx, at emit-rtl.cc:1208 with -fsanitize=address -c

2023-11-23 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112695

Bug ID: 112695
   Summary: ICE: in gen_reg_rtx, at emit-rtl.cc:1208 with
-fsanitize=address -c
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: target
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311021000/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311021000/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311021000
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231102 (experimental) (GCC)

git version: d508a94167c186b2baacc679896e2809554c0b99
***
Program:
$ cat prog.c
_BitInt(33) b33_v;

***
Command Lines:
$ gcc -fsanitize=address -c mutant.c
mutant.c:1:1: internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1208
1 | _BitInt(33) b33_v;
  | ^~~
0x7658cf gen_reg_rtx(machine_mode)
../../gcc/gcc/emit-rtl.cc:1208
0xe9398d maybe_legitimize_operand
../../gcc/gcc/optabs.cc:8044
0xe9398d maybe_legitimize_operands(insn_code, unsigned int, unsigned int,
expand_operand*)
../../gcc/gcc/optabs.cc:8199
0xe8ff69 maybe_gen_insn(insn_code, unsigned int, expand_operand*)
../../gcc/gcc/optabs.cc:8218
0xe99068 expand_binop_directly
../../gcc/gcc/optabs.cc:1457
0xe97460 expand_binop(machine_mode, optab_tag, rtx_def*, rtx_def*, rtx_def*,
int, optab_methods)
../../gcc/gcc/optabs.cc:1544
0xbd0f6d expand_shift_1
../../gcc/gcc/expmed.cc:2675
0xbd5359 expand_shift(tree_code, machine_mode, rtx_def*, poly_int<1u, long>,
rtx_def*, int)
../../gcc/gcc/expmed.cc:2701
0xbfb376 reduce_to_bit_field_precision
../../gcc/gcc/expr.cc:12252
0xbf200f expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc/gcc/expr.cc:11005
0xbfb85e expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
../../gcc/gcc/expr.h:310
0xbfb85e expand_expr_addr_expr_1
../../gcc/gcc/expr.cc:8728
0xbfbed7 expand_expr_addr_expr
../../gcc/gcc/expr.cc:8849
0xbf08ff expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
../../gcc/gcc/expr.cc:12163
0x13876bb expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
../../gcc/gcc/expr.h:310
0x13876bb output_constant
../../gcc/gcc/varasm.cc:5261
0x13863d2 output_constructor_regular_field
../../gcc/gcc/varasm.cc:5612
0x13863d2 output_constructor
../../gcc/gcc/varasm.cc:5878
0x13863d2 output_constructor_regular_field
../../gcc/gcc/varasm.cc:5612
0x13863d2 output_constructor
../../gcc/gcc/varasm.cc:5878
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c/112638] New: ICE: in add_dwarf_attr, at dwarf2out.cc:4501

2023-11-20 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112638

Bug ID: 112638
   Summary: ICE: in add_dwarf_attr, at dwarf2out.cc:4501
   Product: gcc
   Version: 14.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: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311021000/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311021000/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311021000
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231102 (experimental) (GCC)

git version: d508a94167c186b2baacc679896e2809554c0b99
***
Program:
$ cat prog.c
__seg_gs int var;

static int
*foo (void)
{
  int *addr;

  asm ("lea %p1, %0" : "=r"(addr) : "m"(var));

  return addr;
}

static int
bar (int *addr)
{
  int val;

  asm ("mov %%gs:%1, %0" : "=r"(val) : "m"(*addr));

  return val;
}

int
baz (void)
{
  int *addr = foo();
  int val = bar (addr);

  return val;
}
***
Command Lines:
$ gcc -S -O2 -gdwarf-4 prog.c
prog.c:5:1: internal compiler error: in add_dwarf_attr, at dwarf2out.cc:4501
5 | __seg_gs int var;
  | ^~~~
0x75d190 add_dwarf_attr
../../gcc/gcc/dwarf2out.cc:4501
0x75e79c add_dwarf_attr
../../gcc/gcc/vec.h:715
0x75e79c add_AT_string
../../gcc/gcc/dwarf2out.cc:4773
0x75e79c add_name_attribute(die_struct*, char const*)
../../gcc/gcc/dwarf2out.cc:21237
0x75e79c add_name_attribute(die_struct*, char const*)
../../gcc/gcc/dwarf2out.cc:21230
0xb8bfd9 modified_type_die
../../gcc/gcc/dwarf2out.cc:14028
0xb8d396 add_type_attribute
../../gcc/gcc/dwarf2out.cc:22361
0xb9ffda gen_variable_die
../../gcc/gcc/dwarf2out.cc:24678
0xb86188 gen_decl_die
../../gcc/gcc/dwarf2out.cc:27159
0xb876bb dwarf2out_decl
../../gcc/gcc/dwarf2out.cc:27652
0xb87a1c dwarf2out_early_global_decl
../../gcc/gcc/dwarf2out.cc:27299
0x95dc88 finish_decl(tree_node*, unsigned int, tree_node*, tree_node*,
tree_node*)
../../gcc/gcc/c/c-decl.cc:5833
0x9c5ba2 c_parser_declaration_or_fndef
../../gcc/gcc/c/c-parser.cc:2743
0x9d0cfb c_parser_external_declaration
../../gcc/gcc/c/c-parser.cc:1997
0x9d16d5 c_parser_translation_unit
../../gcc/gcc/c/c-parser.cc:1851
0x9d16d5 c_parse_file()
../../gcc/gcc/c/c-parser.cc:25462
0xa43e01 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.cc:1278
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug debug/112582] Inconsistent Variable Values: Discrepancy between Source-Level and Instruction-Level Debugging

2023-11-20 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112582

--- Comment #6 from Anonymous  ---
(In reply to Sam James from comment #5)
> (IIRC = if I recall correctly)

Ah, that explains why my search for "IIRC GCC" on Google didn't yield any
relevant results. Thank you for pointing that out. 

[Bug debug/112582] Inconsistent Variable Values: Discrepancy between Source-Level and Instruction-Level Debugging

2023-11-20 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112582

--- Comment #4 from Anonymous  ---
(In reply to Richard Biener from comment #3)
> I think that's deficiencies in the debugger, IIRC GCC is providing some
> extra info here that it doesn't (yet) evaluate.

Thanks, Richard. I will take a look on the IIRC GCC.

[Bug debug/112582] Inconsistent Variable Values: Discrepancy between Source-Level and Instruction-Level Debugging

2023-11-20 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112582

--- Comment #2 from Anonymous  ---
(In reply to Andrew Pinski from comment #1)
> .cfi_def_cfa_offset 32
> .loc 1 27 5 view .LVU27
> movl$-5, %eax
> .loc 1 28 5 view .LVU28
> movl$-10, %edx
> .loc 1 29 3 view .LVU29 // point where after `si`'s is located
> leaq14(%rsp), %rsi
> leaq12(%rsp), %rdi
> .loc 1 27 5 view .LVU30
> movw%ax, 12(%rsp)
> .loc 1 28 3 is_stmt 1 view .LVU31
> .loc 1 28 5 is_stmt 0 view .LVU32
> movw%dx, 14(%rsp)
> .loc 1 29 3 is_stmt 1 view .LVU33 // point where step is 
> callfoo
> ...
>.ascii "x\0"# DW_AT_name
> # DW_AT_decl_file (1, /app/example.c)
> # DW_AT_decl_line (0x1a)
> .byte   0x16  # DW_AT_decl_column
> .long   0x9e  # DW_AT_type
> .uleb128 0x2# DW_AT_location
> .byte   0x91  # DW_OP_fbreg
> .sleb128 -20
> .uleb128 0x3# (DIE (0x78) DW_TAG_variable)
> .ascii "y\0"# DW_AT_name
> # DW_AT_decl_file (1, /app/example.c)
> # DW_AT_decl_line (0x1a)
> .byte   0x19  # DW_AT_decl_column
> .long   0x9e  # DW_AT_type
> .uleb128 0x2# DW_AT_location
> .byte   0x91  # DW_OP_fbreg
> .sleb128 -18
> 
> Not a bug.

Thank you, Andrew, for your response. I have concerns regarding the information
provided by the debugger, as it may be somewhat misleading. Although the
debugger indicates that lines 27 and 28 have been executed, a closer
examination reveals that the assigned values of the x and y variables do not
align with expected results. From the user's perspective, it appears that lines
27 and 28 have indeed been executed, yet the variable values remain unchanged.
Therefore, I was wondering whether there are any guarantees from the compiler
or debugger.

[Bug c/112605] New: ICE: in gen_reg_rtx, at emit-rtl.cc:1176

2023-11-18 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112605

Bug ID: 112605
   Summary: ICE: in gen_reg_rtx, at emit-rtl.cc:1176
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202311021000/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202311021000/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202311021000
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
--with-sanitizer=address,undefined,thread,leak
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231102 (experimental) (GCC)

git version: d508a94167c186b2baacc679896e2809554c0b99
***
Program:
$ cat prog.c
int x;
int y;

void __attribute__((noinline)) f1(void)
{
x++;
}

static __attribute__((noinline)) void f3(void)
{
y++;
}

void f2()
{
f1();
f3();
f1();
}
***
Command Lines:
$ gcc -c -O2 -mforce-indirect-call -fsplit-stack prog.c
during RTL pass: pro_and_epilogue
prog.c: In function ‘f3’:
prog.c:16:1: internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1176
   16 | }
  | ^
0x7658e3 gen_reg_rtx(machine_mode)
../../gcc/gcc/emit-rtl.cc:1176
0xbcc1ae copy_to_mode_reg(machine_mode, rtx_def*)
../../gcc/gcc/explow.cc:650
0x14c9538 ix86_expand_call(rtx_def*, rtx_def*, rtx_def*, rtx_def*, rtx_def*,
bool)
../../gcc/gcc/config/i386/i386-expand.cc:9707
0x13d7702 ix86_expand_split_stack_prologue()
../../gcc/gcc/config/i386/i386.cc:10486
0x18fe57a gen_split_stack_prologue()
../../gcc/gcc/config/i386/i386.md:18094
0x13bea25 target_gen_split_stack_prologue
../../gcc/gcc/config/i386/i386.md:17849
0xc62e0a make_split_prologue_seq
../../gcc/gcc/function.cc:5785
0xc62e0a make_split_prologue_seq
../../gcc/gcc/function.cc:5778
0xc6301a thread_prologue_and_epilogue_insns()
../../gcc/gcc/function.cc:6039
0xc63752 rest_of_handle_thread_prologue_and_epilogue
../../gcc/gcc/function.cc:6543
0xc63752 execute
../../gcc/gcc/function.cc:6624
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug debug/112582] New: Inconsistent Variable Values: Discrepancy between Source-Level and Instruction-Level Debugging

2023-11-16 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112582

Bug ID: 112582
   Summary: Inconsistent Variable Values: Discrepancy between
Source-Level and Instruction-Level Debugging
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---


As shows in the following, we can observed that the values of variables x and y
exhibit inconsistencies between source-level debugging and instruction-level
debugging prior to entering the function foo. I'm not sure whether the
inconsistency is a result of code optimization.



## source-level debugging ##
$ gcc -O2 -g small.c
root@ubuntu:~# gdb -q a.out
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x401060: file small.c, line 30.
(gdb) r
Starting program: /root/a.out 

Breakpoint 1, main () at small.c:30
30x = -5;
(gdb) s
31y = -10;
(gdb) s
32foo (, );
(gdb) info locals
x = 65531
y = 65526
(gdb) 


## instruction-level debugging ##
$ gcc -O2 -g small.c; gdb -q a.out
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x401060: file small.c, line 27.
(gdb) r
Starting program: /root/a.out 

Breakpoint 1, main () at small.c:27
27x = -5;
(gdb) si
0x00401064  27x = -5;
(gdb) info locals
x = 0
y = 0
(gdb) si
0x00401069  28y = -10;
(gdb) info locals
x = 0
y = 0
(gdb) si
0x0040106e  29foo (, );
(gdb) info locals
x = 0
y = 0
(gdb) 




## bug-triggering code ##

$ cat small.c
extern void abort (void);
extern void exit (int);

__attribute__ ((noinline)) void
foo(short unsigned int *p1, short unsigned int *p2)
{
  short unsigned int x1, x4;
  int x2, x3, x5, x6;
  unsigned int x7;

  x1 = *p1;
  x2 = (int) x1;
  x3 = x2 * 65536;
  x4 = *p2;
  x5 = (int) x4;
  x6 = x3 + x4;
  x7 = (unsigned int) x6;
  if (x7 <= 268435455U)
abort ();
  exit (0);
}

int
main()
{
  short unsigned int x, y;
  x = -5;
  y = -10;
  foo (, );
}



## gcc and gdb version ##
$ gcc --version
gcc (GCC) 14.0.0 20231116 (experimental)
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gdb --version
GNU gdb (GDB) 15.0.50.20231116-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

[Bug debug/112565] Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization

2023-11-16 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565

--- Comment #5 from Anonymous  ---
(In reply to Richard Biener from comment #4)
> GCC can interleave instructions belonging to different source lines so
> that's what you see.  Since you advance assembler instructions I don't see a
> way to
> "improve" things here when optimizing.

Got it. Thanks.

[Bug debug/112565] Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization

2023-11-16 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565

--- Comment #3 from Anonymous  ---
However, I still feel that the current debugging process be somewhat
misleading, and I am uncertain if there are any approaches to enhance the
overall debugging experience.

[Bug debug/112565] Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization

2023-11-16 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565

--- Comment #2 from Anonymous  ---
(In reply to Tom de Vries from comment #1)
> (In reply to Anonymous from comment #0)
> > Tom de Vries suggests that this issue may be attributed to a GCC
> > optimization bug.
> 
> I do not.

Thanks for the correction. I apologize for the misunderstanding. I didn't
notice that you mentioned this behavior was expected.

[Bug debug/112565] New: Abnormal Jump in Execution using 'stepi' Command in GDB under O2 optimization

2023-11-16 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112565

Bug ID: 112565
   Summary: Abnormal Jump in Execution using 'stepi' Command in
GDB under O2 optimization
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: debug
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

Bug reported initially reported:
https://sourceware.org/bugzilla/show_bug.cgi?id=31070

Tom de Vries suggests that this issue may be attributed to a GCC optimization
bug.


$ cat small.c
int glob_int_arr[100];
int *glob_ptr_int = glob_int_arr;

void simple_global ()
{
  __builtin_prefetch (glob_int_arr, 0, 0);
  __builtin_prefetch (glob_ptr_int, 0, 0);
}

int main()
{
  simple_global ();
  exit (0);
}


$ gcc -w -O2 -g small.c; gdb -q a.out
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x401040: file small.c, line 6.
(gdb) r
Starting program: /root/devil/a.out 

Breakpoint 1, main () at small.c:6
6 __builtin_prefetch (glob_int_arr, 0, 0);
(gdb) si
0x00401044 in simple_global () at small.c:7
7 __builtin_prefetch (glob_ptr_int, 0, 0);
(gdb) si
0x0040104b in main () at small.c:13
13exit (0);
(gdb) si
0x0040104d in simple_global () at small.c:6
6 __builtin_prefetch (glob_int_arr, 0, 0);
(gdb)


=
When using the 'stepi' command in GDB, an abnormal jump in the execution occurs
when reaching line 7 of the code. The execution unexpectedly jumps to line 13.


$ gcc --version
gcc (GCC) 14.0.0 20231116 (experimental)
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gdb --version
GNU gdb (GDB) 15.0.50.20231116-git
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

[Bug tree-optimization/111738] incorrect code when PGO is enabled

2023-10-09 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111738

--- Comment #3 from Anonymous  ---
(In reply to Richard Biener from comment #1)
> I can't reproduce.  Your git version is quite old, it translates to
> r14-2634-g85da0b40538fb0 for me.  It doesn't reproduce with r14-2282 either
> though.
> 
> Current is r14-4486-g873586ebc565b6

Hi, Richard. According to your suggestion, we have updated our gcc to the
latest trunk as:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/202310092007/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/202310092007/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/202310092007
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231009 (experimental) (GCC)

git version: dee55cf59ceea989f47e7605205c6644b27a1f78


Then, we compiled the same test program with/without PGO enabled and found that
the results are inconsistent as:
$ gcc -O3 -w -fprofile-generate=profile a.c -o a.out
$ ./a.out
4
$ gcc -O3 -w -fprofile-use=profile -Wno-missing-profile -fprofile-correction
a.c -o a.out
$ ./a.out
32765

[Bug tree-optimization/111738] incorrect code when PGO is enabled

2023-10-09 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111738

--- Comment #2 from Anonymous  ---
(In reply to Richard Biener from comment #1)
> I can't reproduce.  Your git version is quite old, it translates to
> r14-2634-g85da0b40538fb0 for me.  It doesn't reproduce with r14-2282 either
> though.
> 
> Current is r14-4486-g873586ebc565b6

Thank you very much for providing the feedback. To ensure the later reported
bugs can be reproduced, we will update our GCC version to the latest trunk.

[Bug tree-optimization/111739] incorrect code with PGO enabled

2023-10-09 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111739

--- Comment #2 from Anonymous  ---
(In reply to Richard Biener from comment #1)
> Confirmed with r14-4302 and also with the head of the GCC 13 branch.
> 
> It helps if you can produce proper ISO C without implicit int and like.

Thank you for confirming the bug. Moving forward, we will ensure that the code
does not rely on implicit integer types.

[Bug tree-optimization/111739] New: incorrect code with PGO enabled

2023-10-09 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111739

Bug ID: 111739
   Summary: incorrect code with PGO enabled
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/new_gcc/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/new_gcc/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/new_gcc
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230719 (experimental) (GCC)

git version:85da0b40538fb0d17d89de1e7905984668e3dfef
***
Program:
$ cat a.c
c, d, e, a;
union {
  int f;
  short g
} h;
*j = 
k(short l, short m) { return m == 0 || l && m == 1 ?: l / m; }
n(l) { return c == 0 ?: l / c; }
main() {
  a = n(h.f++);
  *j = 0;
  int i = 0;
  for (; i < 2; i++)
d = k(h.g || 0, 59376);
  short *b = 
  *b ^= e;
  printf("%d\n", h);
}

***
Command Lines:
# The profile directory is used to save profile information.
$ gcc -O3 -w -fprofile-generate=profile a.c -o a.out
$ ./a.out
0
$ gcc -O3 -w -fprofile-use=profile -Wno-missing-profile -fprofile-correction
a.c  
 -o a.out
$ ./a.out
1

We can found that, the output of the executable is incorrect when the profile
guided optimization is enabled.

[Bug tree-optimization/111738] New: incorrect code when PGO is enabled

2023-10-09 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111738

Bug ID: 111738
   Summary: incorrect code when PGO is enabled
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: tree-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: iamanonymous.cs at gmail dot com
  Target Milestone: ---

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/new_gcc/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/new_gcc/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/new_gcc
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230719 (experimental) (GCC)

git version:85da0b40538fb0d17d89de1e7905984668e3dfef
***
Program:
$ cat a.c
a = 4, b = 0, d = 0, e = 0, f = 0;
**c = 
*g = 
h() {
  i();
  if (f)
e = 0;
}
i() {
  float j = 0;
  int **k = 
  *k = 
  *g |= **c;
  if (*g)
;
  else {
long *l = d = (*l)++;
  }
}
main() {
  h();
  printf("%d\n", a);
}
***
Command Lines:
# The profile directory is used to save profile information.
$ gcc -O3 -w -fprofile-generate=profile a.c -o a.out
$ ./a.out
4
$ gcc -O3 -w -fprofile-use=profile -Wno-missing-profile -fprofile-correction
a.c  
 -o a.out
$ ./a.out
32764

We can found that, the output of the executable is incorrect when the profile
guided optimization is enabled.

[Bug c/111059] New: ICE: in gimplify_expr, at gimplify.cc:17253

2023-08-18 Thread iamanonymous.cs at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111059

Bug ID: 111059
   Summary: ICE: in gimplify_expr, at gimplify.cc:17253
   Product: gcc
   Version: 14.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: ---

Created attachment 55752
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55752=edit
The program.c mentioned in description.

***
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 version:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/root/gcc_set/new_gcc/bin/gcc
COLLECT_LTO_WRAPPER=/root/gcc_set/new_gcc/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gcc_set/new_gcc
--with-gmp=/root/build_essential --with-mpfr=/root/build_essential
--with-mpc=/root/build_essential --enable-languages=c,c++ --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230719 (experimental) (GCC)

git version:85da0b40538fb0d17d89de1e7905984668e3dfef
***
Program:
The program was attached as program.c
***
Command Lines:
$ gcc program.c -o program
program.c: In function ‘test’:
program.c:188:176: warning: left shift count is negative
[-Wshift-count-negative]
  188 | arr_33 [i_0] [i_1] [i_2] = ((/*
implicit */_Bool) /* implicit */_Bool) (short)1139)) ? ~(((/* implicit
*/int) (unsigned short)9080 << (((/* implicit */int) (signed char)-23 :
(-1376368525)));
  |
   
   ^~
program.c:188:176: internal compiler error: in gimplify_expr, at
gimplify.cc:17253
0x7773da gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:17253
0xc84dba gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:17223
0xc97dc7 gimplify_modify_expr
../../gcc/gcc/gimplify.cc:6173
0xc84fa6 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16441
0xc87a16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7246
0xc86380 gimplify_statement_list
../../gcc/gcc/gimplify.cc:2019
0xc86380 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16886
0xc87a16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7246
0xc96ad9 gimplify_cond_expr
../../gcc/gcc/gimplify.cc:4562
0xc8575c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16398
0xc87a16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7246
0xc86380 gimplify_statement_list
../../gcc/gcc/gimplify.cc:2019
0xc86380 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16886
0xc87a16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7246
0xc86380 gimplify_statement_list
../../gcc/gcc/gimplify.cc:2019
0xc86380 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16886
0xc87a16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7246
0xc88146 gimplify_bind_expr
../../gcc/gcc/gimplify.cc:1430
0xc8525e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.cc:16642
0xc87a16 gimplify_stmt(tree_node**, gimple**)
../../gcc/gcc/gimplify.cc:7246
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See  for instructions.