public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type
@ 2015-02-15 19:48 uroc327 at cssbook dot de
  2015-02-15 19:54 ` [Bug c++/65072] " uroc327 at cssbook dot de
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: uroc327 at cssbook dot de @ 2015-02-15 19:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

            Bug ID: 65072
           Summary: Segfault when parsing dectlype in trailing return type
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: uroc327 at cssbook dot de


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
@ 2015-02-15 19:54 ` uroc327 at cssbook dot de
  2015-03-17 15:56 ` mpolacek at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: uroc327 at cssbook dot de @ 2015-02-15 19:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

uroc327 at cssbook dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uroc327 at cssbook dot de

--- Comment #1 from uroc327 at cssbook dot de ---
Created attachment 34769
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34769&action=edit
preprocessed output + stdout/stderr (first upload didn't seem to work?)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
  2015-02-15 19:54 ` [Bug c++/65072] " uroc327 at cssbook dot de
@ 2015-03-17 15:56 ` mpolacek at gcc dot gnu.org
  2015-03-17 18:46 ` mpolacek at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-17 15:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|NEW                         |ASSIGNED
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.8.5

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Let me look into this.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
  2015-02-15 19:54 ` [Bug c++/65072] " uroc327 at cssbook dot de
  2015-03-17 15:56 ` mpolacek at gcc dot gnu.org
@ 2015-03-17 18:46 ` mpolacek at gcc dot gnu.org
  2015-03-17 18:56 ` trippels at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-17 18:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I couldn't bisect this, but started before r193621.

A bit more reduced:
template <typename> class C
{
  struct
  {
    int i;
  };
  auto operator*(const C m) -> C <decltype (m.i)>;
};
void fn1 (const C<float>);
C<float> a;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (2 preceding siblings ...)
  2015-03-17 18:46 ` mpolacek at gcc dot gnu.org
@ 2015-03-17 18:56 ` trippels at gcc dot gnu.org
  2015-03-17 19:08 ` mpolacek at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: trippels at gcc dot gnu.org @ 2015-03-17 18:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
EDG rejects it:

tes2.ii(7): error: incomplete type is not allowed
    auto operator*(const C m) -> C <decltype (m.i)>;
                                              ^


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (3 preceding siblings ...)
  2015-03-17 18:56 ` trippels at gcc dot gnu.org
@ 2015-03-17 19:08 ` mpolacek at gcc dot gnu.org
  2015-03-19 10:04 ` mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-17 19:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
And clang accepts it.

It looks like we don't need the C<> around decltype:

template <typename> class C
{
  struct
  {
    int i;
  };
  auto operator*(const C m) -> decltype (m.i);
};
void fn1 (const C<float>);
C<float> a;

This one is accepted by clang, gcc 5/4.9/4.8 ICE.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (4 preceding siblings ...)
  2015-03-17 19:08 ` mpolacek at gcc dot gnu.org
@ 2015-03-19 10:04 ` mpolacek at gcc dot gnu.org
  2015-03-19 10:04 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-19 10:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(Just bailing out of build_class_member_access_expr if MEMBER is null fixes the
ICE, but in view of the unclarity above I don't think it's the right fix.)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (5 preceding siblings ...)
  2015-03-19 10:04 ` mpolacek at gcc dot gnu.org
@ 2015-03-19 10:04 ` mpolacek at gcc dot gnu.org
  2015-03-20  9:29 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-19 10:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Here, we SEGV in build_class_member_access_expr, called recursively:

          tree anonymous_union;

          anonymous_union = lookup_anon_field (TREE_TYPE (object),
                                               DECL_CONTEXT (member));
          object = build_class_member_access_expr (object,
                                                   anonymous_union, [...]

anonymous_union is NULL and build_class_member_access_expr is not prepared to
handle that.  anonymous_union is NULL because lookup_anon_field returned NULL:
it tried to look for a "struct ._0" type in "const struct C" -- and found
nothing.  That is because "const struct C" doesn't have any fields!  But if I
change the testcase so that C is not const, it passes, because "struct C" then
has fields and lookup_anon_field is able to find a FIELD_DECL.

So the question is why "const struct C" doesn't have any fields.  I couldn't
figure that out yet :(.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (6 preceding siblings ...)
  2015-03-19 10:04 ` mpolacek at gcc dot gnu.org
@ 2015-03-20  9:29 ` mpolacek at gcc dot gnu.org
  2015-03-20 11:00 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-20  9:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Likely started with r151360 -- which doesn't reveal much, this rev was a part
of LTO merge, dealing with gimplification of types and symbols.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (7 preceding siblings ...)
  2015-03-20  9:29 ` mpolacek at gcc dot gnu.org
@ 2015-03-20 11:00 ` jakub at gcc dot gnu.org
  2015-03-20 12:03 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-03-20 11:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #9)
> Likely started with r151360 -- which doesn't reveal much, this rev was a
> part of LTO merge, dealing with gimplification of types and symbols.

Actually, sorry for the error, it really started with r151529.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (8 preceding siblings ...)
  2015-03-20 11:00 ` jakub at gcc dot gnu.org
@ 2015-03-20 12:03 ` mpolacek at gcc dot gnu.org
  2015-03-20 16:12 ` mpolacek at gcc dot gnu.org
  2015-03-20 16:15 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-20 12:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

--- Comment #11 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #10)
> Actually, sorry for the error, it really started with r151529.

Thanks -- I think I have a fix now.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (9 preceding siblings ...)
  2015-03-20 12:03 ` mpolacek at gcc dot gnu.org
@ 2015-03-20 16:12 ` mpolacek at gcc dot gnu.org
  2015-03-20 16:15 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-20 16:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

--- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri Mar 20 14:56:53 2015
New Revision: 221535

URL: https://gcc.gnu.org/viewcvs?rev=221535&root=gcc&view=rev
Log:
    PR c++/65072
    * typeck.c (lookup_anon_field): Make sure we're dealing with the main
    variant.

    * g++.dg/cpp0x/pr65072.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr65072.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug c++/65072] Segfault when parsing dectlype in trailing return type
  2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
                   ` (10 preceding siblings ...)
  2015-03-20 16:12 ` mpolacek at gcc dot gnu.org
@ 2015-03-20 16:15 ` mpolacek at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-20 16:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65072

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #13 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-03-20 14:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-15 19:48 [Bug c++/65072] New: Segfault when parsing dectlype in trailing return type uroc327 at cssbook dot de
2015-02-15 19:54 ` [Bug c++/65072] " uroc327 at cssbook dot de
2015-03-17 15:56 ` mpolacek at gcc dot gnu.org
2015-03-17 18:46 ` mpolacek at gcc dot gnu.org
2015-03-17 18:56 ` trippels at gcc dot gnu.org
2015-03-17 19:08 ` mpolacek at gcc dot gnu.org
2015-03-19 10:04 ` mpolacek at gcc dot gnu.org
2015-03-19 10:04 ` mpolacek at gcc dot gnu.org
2015-03-20  9:29 ` mpolacek at gcc dot gnu.org
2015-03-20 11:00 ` jakub at gcc dot gnu.org
2015-03-20 12:03 ` mpolacek at gcc dot gnu.org
2015-03-20 16:12 ` mpolacek at gcc dot gnu.org
2015-03-20 16: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).