public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109521] New: Checking ICE (canonical types differ for identical types)
@ 2023-04-15 7:29 sjames at gcc dot gnu.org
2023-04-15 9:30 ` [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-04-15 7:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109521
Bug ID: 109521
Summary: Checking ICE (canonical types differ for identical
types)
Product: gcc
Version: 13.0
URL: https://bugs.gentoo.org/904339
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: sjames at gcc dot gnu.org
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build: x86_64-pc-linux-gnu
Created attachment 54865
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54865&action=edit
optimise.ii.orig.xz
Had this when building form-4.3.0. Originally reported downstream in Gentoo at
https://bugs.gentoo.org/904339.
To trigger this, I had to use -U_GLIBCXX_ASSERTIONS as I have it enabled by
default for my GCC (Gentoo has it enabled by default for hardened, but not all
setups). Obviously this doesn't matter once preprocessed though.
Needs a checking build.
```
$ g++ -DHAVE_CONFIG_H -I. -I.. -O2 -Wall -Wextra -Wpadded
-Wno-misleading-indentation -Wno-stringop-overflow -U_GLIBCXX_ASSERTIONS -c
sources/optimize.cc
‘
during GIMPLE pass: uninit
In function ‘void find_Horner_MCTS()’:
canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char
[7]’} and ‘unsigned char [7]’
2208 | void find_Horner_MCTS () {
| ^~~~~~~~~~~~~~~~
0x68ea0a comptypes(tree_node*, tree_node*, int)
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/cp/typeck.cc:1710
0x22768b9 cxx_types_compatible_p(tree_node*, tree_node*)
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/cp/cp-objcp-common.cc:130
0x11ed84a c_fold_indirect_ref_for_warn
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/c-family/c-pretty-print.cc:1851
0x11edf79 c_fold_indirect_ref_for_warn
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/c-family/c-pretty-print.cc:1918
0x11ee249 print_mem_ref
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/c-family/c-pretty-print.cc:1981
0x7b8b72 expr_to_string(tree_node*)
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/cp/error.cc:3315
0x21adbb0 cp_printer
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/cp/error.cc:4484
0x1a71e85 pp_format(pretty_printer*, text_info*)
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/pretty-print.cc:1475
0x1a710c3 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/diagnostic.cc:1592
0x1aef8c9 diagnostic_impl
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/diagnostic.cc:1756
0x1aef8c9 warning_at(unsigned int, int, char const*, ...)
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/diagnostic.cc:1893
0x9eda7e maybe_warn_operand
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/tree-ssa-uninit.cc:731
0x1d83413 warn_uninitialized_vars
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/tree-ssa-uninit.cc:1098
0x22271fa execute_late_warn_uninitialized
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/tree-ssa-uninit.cc:1406
0x22271fa execute
/usr/src/debug/sys-devel/gcc-13.0.1_pre20230409-r4/gcc-13-20230409/gcc/tree-ssa-uninit.cc:1451
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```
Reduction in progress.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’
2023-04-15 7:29 [Bug c/109521] New: Checking ICE (canonical types differ for identical types) sjames at gcc dot gnu.org
@ 2023-04-15 9:30 ` pinskia at gcc dot gnu.org
2023-04-15 9:42 ` sjames at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 9:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109521
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|11.3.1, 12.2.1, 13.0 |11.1.0
Known to work|10.4.1 |10.4.0
Target Milestone|--- |11.4
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Keywords| |ice-checking,
| |ice-on-valid-code,
| |needs-bisection
Summary|[11/12/13 regression] |[11/12/13 Regression]
|Checking ICE with canonical |Checking ICE with canonical
|types differ for identical |types differ for identical
|types ‘UBYTE [7]’ {aka |types ‘UBYTE [7]’ {aka
|‘unsigned char [7]’} and |‘unsigned char [7]’} and
|‘unsigned char [7]’ |‘unsigned char [7]’
Last reconfirmed| |2023-04-15
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced:
```
struct vector
{
vector& operator=(vector&& __x)
{
return *this;
}
};
struct tree_node {
vector childs;
unsigned char pad[7];
tree_node(){}
};
tree_node mcts_root;
void find_Horner_MCTS_expand_tree () {
mcts_root = tree_node();
}
```
Compile at -O2 -Wall is enough to reproduce the failure.
Note using unsigned short or unsigned int instead of unsigned char allows it to
work.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’
2023-04-15 7:29 [Bug c/109521] New: Checking ICE (canonical types differ for identical types) sjames at gcc dot gnu.org
2023-04-15 9:30 ` [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ pinskia at gcc dot gnu.org
@ 2023-04-15 9:42 ` sjames at gcc dot gnu.org
2023-04-15 12:03 ` [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ since r11-6508-gabb1b6058c09a7 sjames at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-04-15 9:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109521
--- Comment #2 from Sam James <sjames at gcc dot gnu.org> ---
Created attachment 54866
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54866&action=edit
reduced.ii
Yours is better formed, I think, but let me attach the results of cvise which
just finished for the hell of it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ since r11-6508-gabb1b6058c09a7
2023-04-15 7:29 [Bug c/109521] New: Checking ICE (canonical types differ for identical types) sjames at gcc dot gnu.org
2023-04-15 9:30 ` [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ pinskia at gcc dot gnu.org
2023-04-15 9:42 ` sjames at gcc dot gnu.org
@ 2023-04-15 12:03 ` sjames at gcc dot gnu.org
2023-04-16 7:26 ` sjames at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-04-15 12:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109521
Sam James <sjames at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12/13 Regression] |[11/12/13 Regression]
|Checking ICE with canonical |Checking ICE with canonical
|types differ for identical |types differ for identical
|types ‘UBYTE [7]’ {aka |types ‘UBYTE [7]’ {aka
|‘unsigned char [7]’} and |‘unsigned char [7]’} and
|‘unsigned char [7]’ |‘unsigned char [7]’ since
| |r11-6508-gabb1b6058c09a7
CC| |msebor at gcc dot gnu.org
--- Comment #3 from Sam James <sjames at gcc dot gnu.org> ---
Bisect says:
abb1b6058c09a7c0430d9bf019466ada07ca7b40 is the first bad commit
commit abb1b6058c09a7c0430d9bf019466ada07ca7b40
Author: Martin Sebor <msebor@redhat.com>
Date: Wed Jan 6 13:44:27 2021 -0700
PR c++/95768 - pretty-printer ICE on -Wuninitialized with allocated storage
i.e. r11-6508-gabb1b6058c09a7.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ since r11-6508-gabb1b6058c09a7
2023-04-15 7:29 [Bug c/109521] New: Checking ICE (canonical types differ for identical types) sjames at gcc dot gnu.org
` (2 preceding siblings ...)
2023-04-15 12:03 ` [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ since r11-6508-gabb1b6058c09a7 sjames at gcc dot gnu.org
@ 2023-04-16 7:26 ` sjames at gcc dot gnu.org
2023-04-17 7:14 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-04-16 7:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109521
--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
Note that it's also missing the 'internal compiler error' message in the
output.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ since r11-6508-gabb1b6058c09a7
2023-04-15 7:29 [Bug c/109521] New: Checking ICE (canonical types differ for identical types) sjames at gcc dot gnu.org
` (3 preceding siblings ...)
2023-04-16 7:26 ` sjames at gcc dot gnu.org
@ 2023-04-17 7:14 ` rguenth at gcc dot gnu.org
2023-05-29 10:08 ` [Bug c++/109521] [11/12/13/14 " jakub at gcc dot gnu.org
2024-06-27 17:53 ` [Bug c++/109521] [11/12/13/14/15 " mpolacek at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-17 7:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109521
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Priority|P3 |P2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109521] [11/12/13/14 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ since r11-6508-gabb1b6058c09a7
2023-04-15 7:29 [Bug c/109521] New: Checking ICE (canonical types differ for identical types) sjames at gcc dot gnu.org
` (4 preceding siblings ...)
2023-04-17 7:14 ` rguenth at gcc dot gnu.org
@ 2023-05-29 10:08 ` jakub at gcc dot gnu.org
2024-06-27 17:53 ` [Bug c++/109521] [11/12/13/14/15 " mpolacek at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109521
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.4 |11.5
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109521] [11/12/13/14/15 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ since r11-6508-gabb1b6058c09a7
2023-04-15 7:29 [Bug c/109521] New: Checking ICE (canonical types differ for identical types) sjames at gcc dot gnu.org
` (5 preceding siblings ...)
2023-05-29 10:08 ` [Bug c++/109521] [11/12/13/14 " jakub at gcc dot gnu.org
@ 2024-06-27 17:53 ` mpolacek at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-06-27 17:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109521
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
So we have two "unsigned char [7]" types. They are the same except that one
has TYPE_DEPENDENT_P_VALID set.
One of them comes from the C++ FE: grokfield -> grokdeclarator ->
create_array_type_for_decl etc. This has TYPE_DEPENDENT_P_VALID set.
The other one is created in gimple_fold_builtin_memory_op:
1323 desttype = build_array_type_nelts (unsigned_char_type_node,
1324 tree_to_uhwi (len));
1325 srctype = desttype;
1326 if (src_align > TYPE_ALIGN (srctype))
1327 srctype = build_aligned_type (srctype, src_align);
1328 srcvar = fold_build2 (MEM_REF, srctype, src, off0);
this also answers the question why the problem only happens with "unsigned
char".
Later, we warn in maybe_warn_operand: warning_at -> ... -> print_mem_ref which
tries to display:
MEM <unsigned char[7]> [(char * {ref-all})&D.2870 + 1B]
print_mem_ref calls c_fold_indirect_ref_for_warn with this:
1961 tree cop = build3_loc (loc, COMPONENT_REF, TREE_TYPE
(field),
1962 op, field, NULL_TREE);
1963 off = off - upos;
1964 if (tree ret = c_fold_indirect_ref_for_warn (loc, type,
cop,
1965 off))
1966 return ret;
The type of the MEM_REF is the second type. But COP here is D.2870.pad, and
its type is the first one. Comparing those two in
same_type_ignoring_top_level_qualifiers_p will crash since they are the same
types but their canonical types are not identical.
I don't know what the fix would be.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-06-27 17:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-15 7:29 [Bug c/109521] New: Checking ICE (canonical types differ for identical types) sjames at gcc dot gnu.org
2023-04-15 9:30 ` [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ pinskia at gcc dot gnu.org
2023-04-15 9:42 ` sjames at gcc dot gnu.org
2023-04-15 12:03 ` [Bug c++/109521] [11/12/13 Regression] Checking ICE with canonical types differ for identical types ‘UBYTE [7]’ {aka ‘unsigned char [7]’} and ‘unsigned char [7]’ since r11-6508-gabb1b6058c09a7 sjames at gcc dot gnu.org
2023-04-16 7:26 ` sjames at gcc dot gnu.org
2023-04-17 7:14 ` rguenth at gcc dot gnu.org
2023-05-29 10:08 ` [Bug c++/109521] [11/12/13/14 " jakub at gcc dot gnu.org
2024-06-27 17:53 ` [Bug c++/109521] [11/12/13/14/15 " mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).