[Bug c++/109531] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value

2023-04-17 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109531

Martin Liška  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2023-04-17
 Status|UNCONFIRMED |NEW

--- Comment #8 from Martin Liška  ---
> is the more correct way of reducing it similar to my script :).

Sure, this is better not to rely on specific options.

Anyway, reduced to:

$ cat ArithmeticSubtermGeneralization.ii
template  using no_ref_t = int *;
template  class ref_t>
struct ArrayishObjectIterator {
  typedef ref_t _ElementType;
};
struct MappingIterator {
  typedef int *_ElementType;
};
template  struct IterTraits {
  IterTraits map() {}
  template  class Container>
  Container collect();
};
struct Clause {
  typedef int _ElementType;
};
IterTraits> __trans_tmp_3;

$ g++ ArithmeticSubtermGeneralization.ii -c -w
hash table checking failed: equal operator returns true for a pair of values
with a different hash value
ArithmeticSubtermGeneralization.ii: In instantiation of ‘struct
IterTraits >’:
ArithmeticSubtermGeneralization.ii:17:54:   required from here
ArithmeticSubtermGeneralization.ii:12:42: internal compiler error: in
hashtab_chk_error, at hash-table.cc:137
   12 |   Container collect();
  |  ^~~
0x92d1bd hashtab_chk_error()
/home/marxin/Programming/gcc/gcc/hash-table.cc:137
0xb668b2 hash_table::verify(tree_node* const&,
unsigned int)
/home/marxin/Programming/gcc/gcc/hash-table.h:1118
0xb668b2 hash_table::find_slot_with_hash(tree_node* const&, unsigned int,
insert_option)
/home/marxin/Programming/gcc/gcc/hash-table.h:1046
0xb1ede9 hash_table::find_slot(tree_node*
const&, insert_option)
/home/marxin/Programming/gcc/gcc/hash-table.h:435
0xb1ede9 canonical_type_parameter(tree_node*)
/home/marxin/Programming/gcc/gcc/cp/pt.cc:4536
0xb2e141 tsubst(tree_node*, tree_node*, int, tree_node*)
/home/marxin/Programming/gcc/gcc/cp/pt.cc:16298
0xb33018 tsubst_function_type
/home/marxin/Programming/gcc/gcc/cp/pt.cc:15649
0xb2cb3b tsubst(tree_node*, tree_node*, int, tree_node*)
/home/marxin/Programming/gcc/gcc/cp/pt.cc:16468
0xb4e3b9 tsubst_function_decl
/home/marxin/Programming/gcc/gcc/cp/pt.cc:14419
0xb51060 tsubst_template_decl
/home/marxin/Programming/gcc/gcc/cp/pt.cc:14730
0xb2faba tsubst_decl
/home/marxin/Programming/gcc/gcc/cp/pt.cc:14892
0xb5e566 instantiate_class_template(tree_node*)
/home/marxin/Programming/gcc/gcc/cp/pt.cc:12338
0xbb0be8 complete_type(tree_node*)
/home/marxin/Programming/gcc/gcc/cp/typeck.cc:138
0x9d5494 start_decl_1(tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/decl.cc:6002
0x9d5494 start_decl_1(tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/decl.cc:5981
0x9f5507 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
/home/marxin/Programming/gcc/gcc/cp/decl.cc:5968
0xaf8431 cp_parser_init_declarator
/home/marxin/Programming/gcc/gcc/cp/parser.cc:22910
0xacf278 cp_parser_simple_declaration
/home/marxin/Programming/gcc/gcc/cp/parser.cc:15403
0xb03bf3 cp_parser_declaration
/home/marxin/Programming/gcc/gcc/cp/parser.cc:15089
0xb0473a cp_parser_toplevel_declaration
/home/marxin/Programming/gcc/gcc/cp/parser.cc:15110
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++/109531] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value

2023-04-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109531

--- Comment #7 from Andrew Pinski  ---
(In reply to Martin Liška from comment #6)
> You can achieve result with the following command with C-Vise:
> cvise -c 'timeout 5 g++ -std=c++14  -march=znver3 -O2 -fno-strict-aliasing
> -Wall ArithmeticSubtermGeneralization.ii -w -Wfatal-errors 2>&1 | grep
> hashtab_chk_error && timeout 5 g++-13 ArithmeticSubtermGeneralization.ii -c
> -Wfatal-errors -w' ArithmeticSubtermGeneralization.ii
> 
> I'm currently reducing that right now..

No that is different because it only says if it reproduces with those specific
options which it does not have to.

timeout 5 g++ -std=c++14 -w -Wfatal-errors -fno-checking && (( timeout 5 g++
-std=c++14 ArithmeticSubtermGeneralization.ii -w -Wfatal-errors 2>&1 | grep 
hashtab_chk_error) || (timeout 5 g++ -std=c++14  -march=znver3 -O2
-fno-strict-aliasing -Wall ArithmeticSubtermGeneralization.ii -w -Wfatal-errors
2>&1 | grep  hashtab_chk_error))

is the more correct way of reducing it similar to my script :).

[Bug c++/109531] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value

2023-04-17 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109531

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #6 from Martin Liška  ---
(In reply to Andrew Pinski from comment #5)
> >'g++-13 -O2 -Wall -c ArithmeticSubtermGeneralization.ii' is enough to 
> >reproduce.
> 
> Interesting because it was not for me, but I noticed that removing all of
> the lines that begin with "#" is able to reproduce without any options only.
> Anyways my current reproducing script is:
> ```
> if !(~/upstream-gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.1/cc1plus
> -std=c++14 -fno-checking -quiet -Wfatal-errors $1 >& file1.out); then
>   exit 1
> fi
> if !(~/upstream-gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.1/cc1plus
> -std=c++14 -quiet -Wfatal-errors $1 >& file.out); then
>   if grep "hashtab_chk_error" file.out >&/dev/null; then
> exit 0
>   fi
>   exit 1
> fi
> if !(~/upstream-gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.1/cc1plus
> -std=c++14  -march=znver3 -O2 -fno-strict-aliasing -Wall -quiet
> -Wfatal-errors $1 >& file1.out); then
>   if grep "hashtab_chk_error" file1.out >&/dev/null; then
> exit 0
>   fi
>   exit 1
> fi
> ```
> 
> Yes it is more complex than a standard one would be because I want to reduce
> it to be a valid testcase (the first run of cc1plus) and then I noticed
> sometimes it reproduces with slightly different options so test with those.
> Hopefully the -fno-checking is enough to force not checking hashtable
> checking ...

You can achieve result with the following command with C-Vise:
cvise -c 'timeout 5 g++ -std=c++14  -march=znver3 -O2 -fno-strict-aliasing
-Wall ArithmeticSubtermGeneralization.ii -w -Wfatal-errors 2>&1 | grep
hashtab_chk_error && timeout 5 g++-13 ArithmeticSubtermGeneralization.ii -c
-Wfatal-errors -w' ArithmeticSubtermGeneralization.ii

I'm currently reducing that right now..

[Bug c++/109531] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value

2023-04-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109531

--- Comment #5 from Andrew Pinski  ---
>'g++-13 -O2 -Wall -c ArithmeticSubtermGeneralization.ii' is enough to 
>reproduce.

Interesting because it was not for me, but I noticed that removing all of the
lines that begin with "#" is able to reproduce without any options only.
Anyways my current reproducing script is:
```
if !(~/upstream-gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.1/cc1plus -std=c++14
-fno-checking -quiet -Wfatal-errors $1 >& file1.out); then
  exit 1
fi
if !(~/upstream-gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.1/cc1plus -std=c++14
-quiet -Wfatal-errors $1 >& file.out); then
  if grep "hashtab_chk_error" file.out >&/dev/null; then
exit 0
  fi
  exit 1
fi
if !(~/upstream-gcc/libexec/gcc/x86_64-pc-linux-gnu/13.0.1/cc1plus -std=c++14 
-march=znver3 -O2 -fno-strict-aliasing -Wall -quiet -Wfatal-errors $1 >&
file1.out); then
  if grep "hashtab_chk_error" file1.out >&/dev/null; then
exit 0
  fi
  exit 1
fi
```

Yes it is more complex than a standard one would be because I want to reduce it
to be a valid testcase (the first run of cc1plus) and then I noticed sometimes
it reproduces with slightly different options so test with those.
Hopefully the -fno-checking is enough to force not checking hashtable checking
...

[Bug c++/109531] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value

2023-04-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109531

--- Comment #4 from Andrew Pinski  ---
Anyways I am trying to reduce this using delta with a script which tests if it
passes no options (except -Wfatal-errors to speed up the testing); that should
reduce it to a valid testcase I hope.

[Bug c++/109531] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value

2023-04-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109531

--- Comment #3 from Andrew Pinski  ---
I almost want to say there is some GC issue going on with the original
testcase.
When I tried to use topformflat with the source (with all the "^# " lines
removed), it no longer ICEs. But then again I did get a note about
-flarge-source-files which might causing a warning not to be tried which is
exposing the ICE.

[Bug c++/109531] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value

2023-04-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109531

--- Comment #2 from Andrew Pinski  ---
command line that in the end needed to reproduce with the original non-reduced
testcase:
-std=c++14  -march=znver3 -O2 -fno-strict-aliasing -Wall

Note you need all of those options to get the ICE.

[Bug c++/109531] Checking ICE with hash table checking failed: equal operator returns true for a pair of values with a different hash value

2023-04-16 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109531

--- Comment #1 from Sam James  ---
Created attachment 54873
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54873=edit
invalid_reduction.ii

meh, the reduction cvise just finished with is invalid, but it does trigger the
ICE still. I'll include it and try refine it now.