This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/80129] wrong code with ternary struct assignment to const


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).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]