public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)
@ 2013-04-23  8:21 slayoo at staszic dot waw.pl
  2013-04-23  8:56 ` [Bug c++/57041] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: slayoo at staszic dot waw.pl @ 2013-04-23  8:21 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57041

             Bug #: 57041
           Summary: ICE in lookup_field_1, at cp/search.c:376 (with
                    dot-prefixed structure initialisation)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: slayoo@staszic.waw.pl


Hi,


$ cat bug.cpp 
#include <map>
#include <string>

template <class T>
void setopts(T &p)
{
  p.outvars = {{0, {.name = "psi", .unit = "1"}}};
}

int main()
{        
  struct 
  {
    struct info { std::string name, unit; };
    std::map<int, info> outvars;
  } p;
  setopts(p);
}



$ /usr/lib/gcc-snapshot/bin/g++ -std=c++11 bug.cpp 
bug.cpp: In instantiation of 'void setopts(T&) [with T = main()::<anonymous
struct>]':
bug.cpp:17:12:   required from here
bug.cpp:7:13: error: 'name' was not declared in this scope
   p.outvars = {{0, {.name = "psi", .unit = "1"}}};
             ^
bug.cpp:7:13: error: 'unit' was not declared in this scope
bug.cpp:7:13: internal compiler error: in lookup_field_1, at cp/search.c:376
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.
Preprocessed source stored into /tmp/ccLInnuE.out file, please attach this to
your bugreport.



$ /usr/lib/gcc-snapshot/bin/g++ --version
g++ (Debian 20130209-1) 4.8.0 20130209 


Clang compiles it with no warnings or errors.

HTH,
Sylwester


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

* [Bug c++/57041] ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)
  2013-04-23  8:21 [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation) slayoo at staszic dot waw.pl
@ 2013-04-23  8:56 ` mpolacek at gcc dot gnu.org
  2013-04-23  9:41 ` [Bug c++/57041] [4.7/4.8 Regression] " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-04-23  8:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57041

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-23
                 CC|                            |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
     Ever Confirmed|0                           |1
      Known to fail|                            |4.8.0, 4.9.0

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-04-23 08:56:52 UTC ---
Confirmed.


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

* [Bug c++/57041] [4.7/4.8 Regression] ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)
  2013-04-23  8:21 [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation) slayoo at staszic dot waw.pl
  2013-04-23  8:56 ` [Bug c++/57041] " mpolacek at gcc dot gnu.org
@ 2013-04-23  9:41 ` jakub at gcc dot gnu.org
  2013-04-23 10:06 ` [Bug c++/57041] [4.7/4.8/4.9 " mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-23  9:41 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57041

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
            Summary|ICE in lookup_field_1, at   |[4.7/4.8 Regression] ICE in
                   |cp/search.c:376 (with       |lookup_field_1, at
                   |dot-prefixed structure      |cp/search.c:376 (with
                   |initialisation)             |dot-prefixed structure
                   |                            |initialisation)

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-23 09:41:49 UTC ---
Reduced testcase:
namespace std
{
  template <class T1, class T2>
  struct pair
  {
    T1 first;
    T2 second;
  };
  template <class T>
  struct initializer_list
  {
  };
  template <typename T1, typename T2>
  struct map
  {
    map () {}
    map (initializer_list <pair <T1, T2>> l) {}
  };
}
template <class T>
void
foo (T &p)
{
  p.v = { { 0, { .a = 0, .b = 1 } } };
}
int
main ()
{
  struct { struct A { int a, b; }; std::map <int, A> v; } p;
  foo (p);
}

Started to ICE with http://gcc.gnu.org/r176530 .


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

* [Bug c++/57041] [4.7/4.8/4.9 Regression] ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)
  2013-04-23  8:21 [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation) slayoo at staszic dot waw.pl
  2013-04-23  8:56 ` [Bug c++/57041] " mpolacek at gcc dot gnu.org
  2013-04-23  9:41 ` [Bug c++/57041] [4.7/4.8 Regression] " jakub at gcc dot gnu.org
@ 2013-04-23 10:06 ` mpolacek at gcc dot gnu.org
  2013-04-24  9:28 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-04-23 10:06 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57041

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> 2013-04-23 10:06:37 UTC ---
lookup_field_1 instead of IDENTIFIER_NODE gets the error_mark_node, and the
following assert chokes on it:
  gcc_assert (identifier_p (name));

It seems that if we just return NULL_TREE in that case, everything is fine.

--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -381,7 +381,7 @@ lookup_field_1 (tree type, tree name, bool want_type)
 {
   tree field;

-  gcc_assert (identifier_p (name));
+  gcc_assert (identifier_p (name) || name == error_mark_node);

   if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
       || TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM


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

* [Bug c++/57041] [4.7/4.8/4.9 Regression] ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)
  2013-04-23  8:21 [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation) slayoo at staszic dot waw.pl
                   ` (2 preceding siblings ...)
  2013-04-23 10:06 ` [Bug c++/57041] [4.7/4.8/4.9 " mpolacek at gcc dot gnu.org
@ 2013-04-24  9:28 ` paolo.carlini at oracle dot com
  2013-05-13 19:35 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-04-24  9:28 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57041

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-24 09:28:19 UTC ---
This is a Dup of testcase in Comment #2 of PR55365.


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

* [Bug c++/57041] [4.7/4.8/4.9 Regression] ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)
  2013-04-23  8:21 [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation) slayoo at staszic dot waw.pl
                   ` (3 preceding siblings ...)
  2013-04-24  9:28 ` paolo.carlini at oracle dot com
@ 2013-05-13 19:35 ` jason at gcc dot gnu.org
  2013-05-14 14:55 ` jason at gcc dot gnu.org
  2013-05-14 15:53 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-05-13 19:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57041

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Target Milestone|4.9.0                       |4.8.1

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.1.


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

* [Bug c++/57041] [4.7/4.8/4.9 Regression] ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)
  2013-04-23  8:21 [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation) slayoo at staszic dot waw.pl
                   ` (4 preceding siblings ...)
  2013-05-13 19:35 ` jason at gcc dot gnu.org
@ 2013-05-14 14:55 ` jason at gcc dot gnu.org
  2013-05-14 15:53 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2013-05-14 14:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57041

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jasongross9+bugzilla@gmail.
                   |                            |com

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
*** Bug 55365 has been marked as a duplicate of this bug. ***


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

* [Bug c++/57041] [4.7/4.8/4.9 Regression] ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation)
  2013-04-23  8:21 [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation) slayoo at staszic dot waw.pl
                   ` (5 preceding siblings ...)
  2013-05-14 14:55 ` jason at gcc dot gnu.org
@ 2013-05-14 15:53 ` paolo.carlini at oracle dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-14 15:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57041

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
*** Bug 37736 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2013-05-14 15:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-23  8:21 [Bug c++/57041] New: ICE in lookup_field_1, at cp/search.c:376 (with dot-prefixed structure initialisation) slayoo at staszic dot waw.pl
2013-04-23  8:56 ` [Bug c++/57041] " mpolacek at gcc dot gnu.org
2013-04-23  9:41 ` [Bug c++/57041] [4.7/4.8 Regression] " jakub at gcc dot gnu.org
2013-04-23 10:06 ` [Bug c++/57041] [4.7/4.8/4.9 " mpolacek at gcc dot gnu.org
2013-04-24  9:28 ` paolo.carlini at oracle dot com
2013-05-13 19:35 ` jason at gcc dot gnu.org
2013-05-14 14:55 ` jason at gcc dot gnu.org
2013-05-14 15:53 ` paolo.carlini at oracle dot com

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