This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80129] wrong code with ternary struct assignment to const
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 21 Mar 2017 12:18:15 +0000
- Subject: [Bug c++/80129] wrong code with ternary struct assignment to const
- Auto-submitted: auto-generated
- References: <bug-80129-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80129
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Segfaults since r137361, before it has been rejected, so indeed not a
regression.
I think the bug is during gimplification, *.original:
<<cleanup_point bool b = 0;>>;
const struct pair x;
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (x = b ? TARGET_EXPR <D.2040, {.first=1, .second=1}> : TARGET_EXPR
<D.2050, {.first=0, .second=0}>) >>>>>;
looks sane to me, but *.gimple:
static const struct pair x = {.first=1, .second=1};
b = 0;
if (b != 0) goto <D.2077>; else goto <D.2078>;
<D.2077>:
goto <D.2079>;
<D.2078>:
x.first = 0;
x.second = 0;
<D.2079>:
is not due to the const (at least if the VAR_DECL is TREE_READONLY).