public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
@ 2024-08-19 23:25 dansimon09 at gmail dot com
2024-08-20 0:58 ` [Bug c++/116424] " pinskia at gcc dot gnu.org
` (15 more replies)
0 siblings, 16 replies; 17+ messages in thread
From: dansimon09 at gmail dot com @ 2024-08-19 23:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Bug ID: 116424
Summary: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904
creating static object from other static objects
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dansimon09 at gmail dot com
Target Milestone: ---
I'm encountering an ICE with gcc-14.0.1 on ubuntu24.04 when compiling the
following code. I also see the error reproduced with gcc-trunk on compiler
explorer.
Code:
```c++
#include <ranges>
#include <CLI/CLI.hpp>
#include <fmt/format.h>
class EndsWithValidator: public CLI::CustomValidator {
public:
EndsWithValidator(std::string ext, bool case_sensitive = true)
noexcept(false) : CLI::CustomValidator() {
desc_function_ = [desc=fmt::format("Ends With {}", ext)](){ return
desc; };
name_ = fmt::format("String Ends With {} Validator", ext);
non_modifying_ = true;
if (case_sensitive) {
func_ = [ext=std::move(ext)](const std::string& string){
return string.ends_with(ext) ? std::string{} :
fmt::format(R"(String "{}" does not end with "{}")",
string, ext);
};
} else {
std::ranges::for_each(ext, [](auto& c){ c = std::tolower(c); });
func_ = [ext=std::move(ext)](std::string string){
std::ranges::for_each(string, [](auto& c){ c = std::tolower(c);
});
return string.ends_with(ext) ? std::string{} :
fmt::format(R"(String "{}" does not end with "{}" (case
insensitive))", string, ext);
};
}
}
};
static const CLI::CustomValidator ExtensionJSONGLTFValidator =
EndsWithValidator(".gltf", false);
static const CLI::CustomValidator ExtensionGLBValidator =
EndsWithValidator(".glb", false);
static const CLI::CustomValidator
ExtensionGLTFValidator(ExtensionJSONGLTFValidator | ExtensionGLBValidator);
```
Compiler output:
```
FAILED: Consumer.cpp.o
/usr/bin/g++-14 -D_GLIBCXX_USE_CXX11_ABI=1
-D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING -isystem
project/cmake-build-debug-gnu-intel/vcpkg_installed/x64-linux/include -g
-std=gnu++20 -fdiagnostics-color=always -MD -MT Consumer.cpp.o -MF
Consumer.cpp.o.d -fmodules-ts -fmodule-mapper=Consumer.cpp.o.modmap -MD
-fdeps-format=p1689r5 -x c++ -o Consumer.cpp.o -c project/Consumer.cpp
In file included from project/Consumer.cpp:22:
project/Validators.hpp: In function ‘void
__static_initialization_and_destruction_0()’:
project/Validators.hpp:32:85: internal compiler error: in cp_gimplify_expr, at
cp/cp-gimplify.cc:904
60 | static const CLI::CustomValidator
ExtensionGLTFValidator(ExtensionJSONGLTFValidator | ExtensionGLBValidator);
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
0x732c70 cp_gimplify_expr(tree_node**, gimple**, gimple**)
../../src/gcc/cp/cp-gimplify.cc:904
0x14bd34d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.cc:17789
0x14c8860 gimplify_addr_expr
../../src/gcc/gimplify.cc:6911
0x14be0b7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.cc:17930
0x14d0341 gimplify_expr
../../src/gcc/gimplify.cc:18952
0x14d0341 gimplify_arg(tree_node**, gimple**, unsigned int, bool)
../../src/gcc/gimplify.cc:3778
0x14d09e3 gimplify_call_expr
../../src/gcc/gimplify.cc:4063
0x14be026 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.cc:17852
0x14d61c3 gimplify_cleanup_point_expr
../../src/gcc/gimplify.cc:7577
0x14be007 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.cc:18276
0x14c036a gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.cc:7577
0x14bee1b gimplify_statement_list
../../src/gcc/gimplify.cc:2249
0x14bee1b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.cc:18328
0x14d582f gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.cc:7577
0x14d582f gimplify_body(tree_node*, bool)
../../src/gcc/gimplify.cc:19150
0x14d5c5a gimplify_function_tree(tree_node*)
../../src/gcc/gimplify.cc:19351
0x12e1317 cgraph_node::analyze()
../../src/gcc/cgraphunit.cc:687
0x12e3e97 analyze_functions
../../src/gcc/cgraphunit.cc:1251
0x12e4e21 symbol_table::finalize_compilation_unit()
../../src/gcc/cgraphunit.cc:2560
```
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
@ 2024-08-20 0:58 ` pinskia at gcc dot gnu.org
2024-08-20 1:02 ` pinskia at gcc dot gnu.org
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-20 0:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2024-08-20
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you attach the preprocessed source?
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
2024-08-20 0:58 ` [Bug c++/116424] " pinskia at gcc dot gnu.org
@ 2024-08-20 1:02 ` pinskia at gcc dot gnu.org
2024-08-20 1:04 ` pinskia at gcc dot gnu.org
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-20 1:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|1 |0
Status|WAITING |UNCONFIRMED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
never mind ...
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
2024-08-20 0:58 ` [Bug c++/116424] " pinskia at gcc dot gnu.org
2024-08-20 1:02 ` pinskia at gcc dot gnu.org
@ 2024-08-20 1:04 ` pinskia at gcc dot gnu.org
2024-08-20 1:06 ` pinskia at gcc dot gnu.org
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-20 1:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 58960
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58960&action=edit
Preprocessed source
Note I removed the body of EndsWithValidator::EndsWithValidator and the include
fmt/format.h and ranges since they are not needed to get the ICE.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (2 preceding siblings ...)
2024-08-20 1:04 ` pinskia at gcc dot gnu.org
@ 2024-08-20 1:06 ` pinskia at gcc dot gnu.org
2024-08-20 1:34 ` pinskia at gcc dot gnu.org
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-20 1:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reducing ...
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (3 preceding siblings ...)
2024-08-20 1:06 ` pinskia at gcc dot gnu.org
@ 2024-08-20 1:34 ` pinskia at gcc dot gnu.org
2024-08-20 1:38 ` pinskia at gcc dot gnu.org
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-20 1:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduded with string include still:
```
#include <string>
struct Validator {
std::string name_{};
int application_index_ = -1;
bool active_{true};
bool non_modifying_{false};
Validator operator|(const Validator &other) const;
};
class cc : public Validator { };
static const cc a;
static const cc b;
static const cc c(a | b);
```
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (4 preceding siblings ...)
2024-08-20 1:34 ` pinskia at gcc dot gnu.org
@ 2024-08-20 1:38 ` pinskia at gcc dot gnu.org
2024-08-20 2:24 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-20 1:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection
Known to fail| |13.0, 15.0
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
/* Likewise, but allow extra temps of trivial type so that
gimplify_init_ctor_preeval can materialize subobjects of a CONSTRUCTOR
on the rhs of an assignment, as in constexpr-aggr1.C. */
gcc_checking_assert (!TARGET_EXPR_ELIDING_P (*expr_p)
|| !TREE_ADDRESSABLE (TREE_TYPE (*expr_p)));
Looks like the ICE started in GCC 13 ...
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (5 preceding siblings ...)
2024-08-20 1:38 ` pinskia at gcc dot gnu.org
@ 2024-08-20 2:24 ` pinskia at gcc dot gnu.org
2024-08-20 2:28 ` [Bug c++/116424] [13/14/15 Regression] " pinskia at gcc dot gnu.org
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-20 2:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
struct dd {
char *ptr;
dd();
dd(dd &&__str);
};
struct v {
dd n{};
int f = -1;
v operator|(const v &other) const;
};
struct cc : v {};
static const cc a;
static const cc b;
static const cc c(a | b);
```
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14/15 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (6 preceding siblings ...)
2024-08-20 2:24 ` pinskia at gcc dot gnu.org
@ 2024-08-20 2:28 ` pinskia at gcc dot gnu.org
2024-08-20 7:31 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-08-20 2:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.4
Summary|ICE in cp_gimplify_expr, at |[13/14/15 Regression] ICE
|cp/cp-gimplify.c:904 |in cp_gimplify_expr, at
|creating static object from |cp/cp-gimplify.c:904
|other static objects |creating static object from
| |other static objects
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It worked at r12-7235-g1f8a09d2f3c69f .
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14/15 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (7 preceding siblings ...)
2024-08-20 2:28 ` [Bug c++/116424] [13/14/15 Regression] " pinskia at gcc dot gnu.org
@ 2024-08-20 7:31 ` rguenth at gcc dot gnu.org
2024-08-21 14:42 ` mpolacek at gcc dot gnu.org
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-08-20 7:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14/15 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (8 preceding siblings ...)
2024-08-20 7:31 ` rguenth at gcc dot gnu.org
@ 2024-08-21 14:42 ` mpolacek at gcc dot gnu.org
2024-08-21 15:27 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-08-21 14:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection |
CC| |mpolacek at gcc dot gnu.org
--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r13-3175:
commit 6ffbf87ca66f4ed9cd79cff675fabe2109e46e85
Author: Jason Merrill <jason@redhat.com>
Date: Sat Sep 17 12:04:05 2022 +0200
c++: track whether we expect a TARGET_EXPR to be elided
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14/15 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (9 preceding siblings ...)
2024-08-21 14:42 ` mpolacek at gcc dot gnu.org
@ 2024-08-21 15:27 ` mpolacek at gcc dot gnu.org
2024-08-21 15:32 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-08-21 15:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We are taking the address of the TARGET_EXPR:
v::v (&c.D.2588, &TARGET_EXPR <D.2675, <<< Unknown tree: aggr_init_expr
5
operator|
D.2675
&a.D.2588
(const struct v &) &b.D.2588 >>>>)
so we can't elide it. This sounds awfully similar to something I fixed
recently.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14/15 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (10 preceding siblings ...)
2024-08-21 15:27 ` mpolacek at gcc dot gnu.org
@ 2024-08-21 15:32 ` mpolacek at gcc dot gnu.org
2024-08-21 15:48 ` mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-08-21 15:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
--- Comment #11 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Ah, bug 114854 which is already in See Also...
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14/15 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (11 preceding siblings ...)
2024-08-21 15:32 ` mpolacek at gcc dot gnu.org
@ 2024-08-21 15:48 ` mpolacek at gcc dot gnu.org
2024-08-22 13:22 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-08-21 15:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
--- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We set TARGET_EXPR_ELIDING_P in massage_init_elt.
Not setting TARGET_EXPR_ELIDING_P when the target expr isn't
TARGET_EXPR_DIRECT_INIT_P breaks nsdmi-aggr21.C.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14/15 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (12 preceding siblings ...)
2024-08-21 15:48 ` mpolacek at gcc dot gnu.org
@ 2024-08-22 13:22 ` mpolacek at gcc dot gnu.org
2024-08-28 15:54 ` cvs-commit at gcc dot gnu.org
2024-08-28 15:55 ` [Bug c++/116424] [13/14 " mpolacek at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-08-22 13:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
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
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14/15 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (13 preceding siblings ...)
2024-08-22 13:22 ` mpolacek at gcc dot gnu.org
@ 2024-08-28 15:54 ` cvs-commit at gcc dot gnu.org
2024-08-28 15:55 ` [Bug c++/116424] [13/14 " mpolacek at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-08-28 15:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
--- Comment #13 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:15f857af2943a4aa282d04ff71f860352ad3291b
commit r15-3262-g15f857af2943a4aa282d04ff71f860352ad3291b
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Aug 27 18:25:17 2024 -0400
c++: ICE with ()-init and TARGET_EXPR eliding [PR116424]
Here we crash on a cp_gimplify_expr/TARGET_EXPR assert:
gcc_checking_assert (!TARGET_EXPR_ELIDING_P (*expr_p)
|| !TREE_ADDRESSABLE (TREE_TYPE (*expr_p)));
We cannot elide the TARGET_EXPR because we're taking its address.
It is set as eliding in massage_init_elt. I've tried to not set
TARGET_EXPR_ELIDING_P when the context is not direct-initialization.
That didn't work: even when it's not direct-initialization now, it
can become one later, for instance, after split_nonconstant_init.
One problem is that replace_placeholders_for_class_temp_r will replace
placeholders in non-eliding TARGET_EXPRs with the slot, but if we then
elide the TARGET_EXPR, we end up with a "stray" VAR_DECL and crash.
(Only some TARGET_EXPRs are handled by replace_decl.)
I thought I'd have to go back to
<https://gcc.gnu.org/pipermail/gcc-patches/2024-May/651163.html> but
then I realized that this problem occurrs only with ()-init but not
{}-init. With {}-init, there is no problem, because we are clearing
TARGET_EXPR_ELIDING_P in process_init_constructor_record:
/* We can't actually elide the temporary when initializing a
potentially-overlapping field from a function that returns by
value. */
if (ce->index
&& TREE_CODE (next) == TARGET_EXPR
&& unsafe_copy_elision_p (ce->index, next))
TARGET_EXPR_ELIDING_P (next) = false;
But that does not happen for ()-init because we have no ce->index.
()-init doesn't allow brace elision so we don't really reshape them.
But I can just move the clearing a few lines down and then it handles
both ()-init and {}-init.
PR c++/116424
gcc/cp/ChangeLog:
* typeck2.cc (process_init_constructor_record): Move the clearing
of
TARGET_EXPR_ELIDING_P down.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/paren-init38.C: New test.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [Bug c++/116424] [13/14 Regression] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
` (14 preceding siblings ...)
2024-08-28 15:54 ` cvs-commit at gcc dot gnu.org
@ 2024-08-28 15:55 ` mpolacek at gcc dot gnu.org
15 siblings, 0 replies; 17+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-08-28 15:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116424
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[13/14/15 Regression] ICE |[13/14 Regression] ICE in
|in cp_gimplify_expr, at |cp_gimplify_expr, at
|cp/cp-gimplify.c:904 |cp/cp-gimplify.c:904
|creating static object from |creating static object from
|other static objects |other static objects
--- Comment #14 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-08-28 15:55 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-19 23:25 [Bug c++/116424] New: ICE in cp_gimplify_expr, at cp/cp-gimplify.c:904 creating static object from other static objects dansimon09 at gmail dot com
2024-08-20 0:58 ` [Bug c++/116424] " pinskia at gcc dot gnu.org
2024-08-20 1:02 ` pinskia at gcc dot gnu.org
2024-08-20 1:04 ` pinskia at gcc dot gnu.org
2024-08-20 1:06 ` pinskia at gcc dot gnu.org
2024-08-20 1:34 ` pinskia at gcc dot gnu.org
2024-08-20 1:38 ` pinskia at gcc dot gnu.org
2024-08-20 2:24 ` pinskia at gcc dot gnu.org
2024-08-20 2:28 ` [Bug c++/116424] [13/14/15 Regression] " pinskia at gcc dot gnu.org
2024-08-20 7:31 ` rguenth at gcc dot gnu.org
2024-08-21 14:42 ` mpolacek at gcc dot gnu.org
2024-08-21 15:27 ` mpolacek at gcc dot gnu.org
2024-08-21 15:32 ` mpolacek at gcc dot gnu.org
2024-08-21 15:48 ` mpolacek at gcc dot gnu.org
2024-08-22 13:22 ` mpolacek at gcc dot gnu.org
2024-08-28 15:54 ` cvs-commit at gcc dot gnu.org
2024-08-28 15:55 ` [Bug c++/116424] [13/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).