public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/116534] New: [14 regression] internal compiler error with comparison of pointers calculated with array offset
@ 2024-08-29 13:51 john at drouhard dot dev
2024-08-29 14:04 ` [Bug c++/116534] " mpolacek at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: john at drouhard dot dev @ 2024-08-29 13:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116534
Bug ID: 116534
Summary: [14 regression] internal compiler error with
comparison of pointers calculated with array offset
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: john at drouhard dot dev
Target Milestone: ---
The following produces an internal compiler when compiled with -Wall starting
with gcc 14:
$ cat test.cpp
template <class A>
class Test {
void foo(unsigned x, unsigned y) {
bool test = &a[x] == &b[y];
}
unsigned *a;
unsigned *b;
};
$ g++ -Wall ./test.cpp
./test.cpp: In member function 'void Test<A>::foo(unsigned int, unsigned int)':
./test.cpp:4:34: internal compiler error: Segmentation fault
4 | bool test = &a[x] == &b[y];
| ^
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/116534] [14 regression] internal compiler error with comparison of pointers calculated with array offset
2024-08-29 13:51 [Bug c++/116534] New: [14 regression] internal compiler error with comparison of pointers calculated with array offset john at drouhard dot dev
@ 2024-08-29 14:04 ` mpolacek at gcc dot gnu.org
2024-08-29 14:36 ` [Bug c++/116534] [14/15 " mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-08-29 14:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116534
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-08-29
Keywords| |ice-on-valid-code
Priority|P3 |P2
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |mpolacek at gcc dot gnu.org
Target Milestone|--- |14.3
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r14-4793:
commit dad311874ac3b3cf4eca1c04f67cae80c953f7b8
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Oct 20 10:45:00 2023 -0400
c++: remove NON_DEPENDENT_EXPR, part 1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/116534] [14/15 regression] internal compiler error with comparison of pointers calculated with array offset
2024-08-29 13:51 [Bug c++/116534] New: [14 regression] internal compiler error with comparison of pointers calculated with array offset john at drouhard dot dev
2024-08-29 14:04 ` [Bug c++/116534] " mpolacek at gcc dot gnu.org
@ 2024-08-29 14:36 ` mpolacek at gcc dot gnu.org
2024-09-17 21:03 ` cvs-commit at gcc dot gnu.org
2024-09-17 21:05 ` [Bug c++/116534] [14 " mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-08-29 14:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116534
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Summary|[14 regression] internal |[14/15 regression] internal
|compiler error with |compiler error with
|comparison of pointers |comparison of pointers
|calculated with array |calculated with array
|offset |offset
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/116534] [14/15 regression] internal compiler error with comparison of pointers calculated with array offset
2024-08-29 13:51 [Bug c++/116534] New: [14 regression] internal compiler error with comparison of pointers calculated with array offset john at drouhard dot dev
2024-08-29 14:04 ` [Bug c++/116534] " mpolacek at gcc dot gnu.org
2024-08-29 14:36 ` [Bug c++/116534] [14/15 " mpolacek at gcc dot gnu.org
@ 2024-09-17 21:03 ` cvs-commit at gcc dot gnu.org
2024-09-17 21:05 ` [Bug c++/116534] [14 " mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-09-17 21:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116534
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:7ca486889b1b1c7e7bcbbca3b6caa103294ec07d
commit r15-3673-g7ca486889b1b1c7e7bcbbca3b6caa103294ec07d
Author: Marek Polacek <polacek@redhat.com>
Date: Thu Aug 29 10:40:50 2024 -0400
c++: ICE with -Wtautological-compare in template [PR116534]
Pre r14-4793, we'd call warn_tautological_cmp -> operand_equal_p
with operands wrapped in NON_DEPENDENT_EXPR, which works, since
o_e_p bails for codes it doesn't know. But now we pass operands
not encapsulated in NON_DEPENDENT_EXPR, and crash, because the
template tree for &a[x] has null DECL_FIELD_OFFSET.
This patch extends r12-7797 to cover the case when DECL_FIELD_OFFSET
is null.
PR c++/116534
gcc/ChangeLog:
* fold-const.cc (operand_compare::operand_equal_p): If either
field's DECL_FIELD_OFFSET is null, compare the fields with ==.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Wtautological-compare4.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/116534] [14 regression] internal compiler error with comparison of pointers calculated with array offset
2024-08-29 13:51 [Bug c++/116534] New: [14 regression] internal compiler error with comparison of pointers calculated with array offset john at drouhard dot dev
` (2 preceding siblings ...)
2024-09-17 21:03 ` cvs-commit at gcc dot gnu.org
@ 2024-09-17 21:05 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-09-17 21:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116534
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[14/15 regression] internal |[14 regression] internal
|compiler error with |compiler error with
|comparison of pointers |comparison of pointers
|calculated with array |calculated with array
|offset |offset
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-17 21:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-29 13:51 [Bug c++/116534] New: [14 regression] internal compiler error with comparison of pointers calculated with array offset john at drouhard dot dev
2024-08-29 14:04 ` [Bug c++/116534] " mpolacek at gcc dot gnu.org
2024-08-29 14:36 ` [Bug c++/116534] [14/15 " mpolacek at gcc dot gnu.org
2024-09-17 21:03 ` cvs-commit at gcc dot gnu.org
2024-09-17 21:05 ` [Bug c++/116534] [14 " 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).