public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64171] New: Hang whilst printing error message on invalid code
@ 2014-12-03 19:27 jleahy+gcc at gmail dot com
  2014-12-08 18:01 ` [Bug c++/64171] " ville.voutilainen at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jleahy+gcc at gmail dot com @ 2014-12-03 19:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64171
           Summary: Hang whilst printing error message on invalid code
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jleahy+gcc at gmail dot com

Created attachment 34181
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34181&action=edit
full preprocessed source

The following code is invalid (the constness 'var' doesn't match), but the
compiler seems to enter an infinite loop whilst printing the error message.

I've attached full preprocessed source.

The target is x86_64-unknown-linux-gnu.

Code:

#include <unordered_map>

struct X {
    static X * fromString();

    X(int x, int y);

    static const std::unordered_map<int, X> var;
};


std::unordered_map<int, X> X::var = {
    {0, X(0, 0)},
};


X * X::fromString() {
    std::unordered_map<int, X>::iterator it = var.find(0);
    if (it == var.end()) return 0;
    return &(it->second);
}

Complete output: (upto point where compiler hangs)

bug.cpp:13:31: error: conflicting declaration 'std::unordered_map<int, X>
X::var'
 std::unordered_map<int, X> X::var = {
                               ^
bug.cpp:9:45: note: previous declaration as 'const std::unordered_map<int, X>
X::var'
     static const std::unordered_map<int, X> var;
                                             ^
bug.cpp:13:31: error: declaration of 'const std::unordered_map<int, X> X::var'
outside of class is not definition [-fpermissive]
 std::unordered_map<int, X> X::var = {
                               ^
bug.cpp: In static member function 'static X* X::fromString()':
bug.cpp:19:57: error: conversion from 'std::unordered_map<int,
X>::const_iterator {aka std::__detail::_Node_const_iterator<std::pair<const
int, X>, false, false>}' to non-scalar type 'std::unordered_map<int,
X>::iterator {aka std::__detail::_Node_iterator<std::pair<const int, X>, false,
false>}' requested
     std::unordered_map<int, X>::iterator it = var.find(0);
                                                         ^


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

* [Bug c++/64171] Hang whilst printing error message on invalid code
  2014-12-03 19:27 [Bug c++/64171] New: Hang whilst printing error message on invalid code jleahy+gcc at gmail dot com
@ 2014-12-08 18:01 ` ville.voutilainen at gmail dot com
  2015-03-04  7:56 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-08 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-08
                 CC|                            |ville.voutilainen at gmail dot com
     Ever confirmed|0                           |1

--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
The test ICEs on trunk:

[ville@localhost ~]$ g++ --std=c++1y -c 64171.cpp 
64171.cpp:12:31: error: conflicting declaration ‘std::unordered_map<int, X>
X::var’
 std::unordered_map<int, X> X::var = {
                               ^
64171.cpp:8:45: note: previous declaration as ‘const std::unordered_map<int, X>
X::var’
     static const std::unordered_map<int, X> var;
                                             ^
64171.cpp:12:31: error: declaration of ‘const std::unordered_map<int, X>
X::var’ outside of class is not definition [-fpermissive]
 std::unordered_map<int, X> X::var = {
                               ^
64171.cpp: In static member function ‘static X* X::fromString()’:
64171.cpp:18:55: error: conversion from ‘std::unordered_map<int,
X>::const_iterator {aka std::__detail::_Node_const_iterator<std::pair<const
int, X>, false, false>}’ to non-scalar type ‘std::unordered_map<int,
X>::iterator {aka std::__detail::_Node_iterator<std::pair<const int, X>, false,
false>}’ requested
     std::unordered_map<int, X>::iterator it = var.find(0);
                                                       ^
At global scope:
cc1plus: internal compiler error: in record_reference, at cgraphbuild.c:87
0x8e28a3 record_reference
        ../../gcc/cgraphbuild.c:87
0xf1a76d walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hashset_traits>*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hashset_traits>*))
        ../../gcc/tree.c:11022
0xf1ad79 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hashset_traits>*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hashset_traits>*))
        ../../gcc/tree.c:11309
0x8e3386 record_references_in_initializer(tree_node*, bool)
        ../../gcc/cgraphbuild.c:426
0xf575b7 varpool_node::analyze()
        ../../gcc/varpool.c:533
0x8e914f analyze_functions
        ../../gcc/cgraphunit.c:1032
0x8e9985 symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.c:2331
0x6c1fdb cp_write_global_declarations()
        ../../gcc/cp/decl2.c:4688
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
>From gcc-bugs-return-469781-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Dec 08 18:04:17 2014
Return-Path: <gcc-bugs-return-469781-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23718 invoked by alias); 8 Dec 2014 18:04:17 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 23699 invoked by uid 48); 8 Dec 2014 18:04:14 -0000
From: "ville.voutilainen at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/62212] ICE compiling template function with array reference parameter whose size depends on a template parameter
Date: Mon, 08 Dec 2014 18:04:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ville.voutilainen at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords bug_status cf_reconfirmed_on cc everconfirmed
Message-ID: <bug-62212-4-Jufru1DN3c@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62212-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62212-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg00788.txt.bz2
Content-length: 565

https://gcc.gnu.org/bugzilla/show_bug.cgi?idb212

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-08
                 CC|                            |ville.voutilainen at gmail dot com
     Ever confirmed|0                           |1


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

* [Bug c++/64171] Hang whilst printing error message on invalid code
  2014-12-03 19:27 [Bug c++/64171] New: Hang whilst printing error message on invalid code jleahy+gcc at gmail dot com
  2014-12-08 18:01 ` [Bug c++/64171] " ville.voutilainen at gmail dot com
@ 2015-03-04  7:56 ` paolo.carlini at oracle dot com
  2015-03-04  8:11 ` ville.voutilainen at gmail dot com
  2015-03-04  9:29 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-04  7:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paolo.carlini at oracle dot com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Today I can't reproduce the issue in mainline. Ville, can you double check?


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

* [Bug c++/64171] Hang whilst printing error message on invalid code
  2014-12-03 19:27 [Bug c++/64171] New: Hang whilst printing error message on invalid code jleahy+gcc at gmail dot com
  2014-12-08 18:01 ` [Bug c++/64171] " ville.voutilainen at gmail dot com
  2015-03-04  7:56 ` paolo.carlini at oracle dot com
@ 2015-03-04  8:11 ` ville.voutilainen at gmail dot com
  2015-03-04  9:29 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-03-04  8:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
(In reply to Paolo Carlini from comment #2)
> Today I can't reproduce the issue in mainline. Ville, can you double check?

Works fine for me on current trunk, no ICE, no hang.


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

* [Bug c++/64171] Hang whilst printing error message on invalid code
  2014-12-03 19:27 [Bug c++/64171] New: Hang whilst printing error message on invalid code jleahy+gcc at gmail dot com
                   ` (2 preceding siblings ...)
  2015-03-04  8:11 ` ville.voutilainen at gmail dot com
@ 2015-03-04  9:29 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-03-04  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|paolo.carlini at oracle dot com    |
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Ok, thanks.


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

end of thread, other threads:[~2015-03-04  9:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-03 19:27 [Bug c++/64171] New: Hang whilst printing error message on invalid code jleahy+gcc at gmail dot com
2014-12-08 18:01 ` [Bug c++/64171] " ville.voutilainen at gmail dot com
2015-03-04  7:56 ` paolo.carlini at oracle dot com
2015-03-04  8:11 ` ville.voutilainen at gmail dot com
2015-03-04  9:29 ` 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).