Bug 42701 - [4.5 Regression] ICE on error recovery
Summary: [4.5 Regression] ICE on error recovery
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.5.0
: P1 normal
Target Milestone: 4.5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic, ice-on-valid-code
: 42569 42725 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-12 12:16 UTC by Matthias Klose
Modified: 2010-01-15 06:18 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.5.0
Last reconfirmed: 2010-01-12 14:30:35


Attachments
preprocessed source (165.33 KB, application/x-gzip)
2010-01-12 12:16 UTC, Matthias Klose
Details
reduced testcase (1.38 KB, text/plain)
2010-01-12 14:30 UTC, Richard Biener
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2010-01-12 12:16:05 UTC
seen with trunk 20100107 on ix86:

$ g++ -c greg_month.ii
In file included from ./boost/date_time/gregorian/formatters.hpp:17:0,
                 from libs/date_time/src/gregorian/greg_month.cpp:21:
./boost/date_time/date_formatting.hpp: In static member function 'static std::basic_string<charT> boost::date_time::ymd_formatter<ymd_type, format_type, charT>::ymd_to_string(ymd_type)':
./boost/date_time/date_formatting.hpp:87:36: error: cannot call constructor 'std::locale::locale' directly
./boost/date_time/date_formatting.hpp:87:36: note: for a function-style cast, remove the redundant '::locale'
./boost/date_time/gregorian/formatters.hpp:65: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccNSCpcB.out file, please attach this to your bugreport.
Comment 1 Matthias Klose 2010-01-12 12:16:25 UTC
Created attachment 19546 [details]
preprocessed source
Comment 2 Paolo Carlini 2010-01-12 12:49:38 UTC
As usual, please reduce these beasts...
Comment 3 Richard Biener 2010-01-12 13:43:01 UTC
You can use -fpermissive in which case it's no longer error-recovery.

The emitted warning doesn't vanish with -w, the note stays:

> ./cc1plus -quiet greg_month.ii  -m32 -fpermissive -w
In file included from ./boost/date_time/gregorian/formatters.hpp:17:0,
                 from libs/date_time/src/gregorian/greg_month.cpp:21:
./boost/date_time/date_formatting.hpp: In static member function 'static std::basic_string<charT> boost::date_time::ymd_formatter<ymd_type, format_type, charT>::ymd_to_string(ymd_type)':
./boost/date_time/date_formatting.hpp:87:36: note: for a function-style cast, remove the redundant '::locale'
In file included from libs/date_time/src/gregorian/greg_month.cpp:21:0:
./boost/date_time/gregorian/formatters.hpp: In function 'std::basic_string<_CharT> boost::gregorian::to_iso_string_type(const boost::gregorian::date_period&) [with charT = char, boost::gregorian::date_period = boost::date_time::period<boost::gregorian::date, boost::gregorian::date_duration>]':
./boost/date_time/gregorian/formatters.hpp:72:38:   instantiated from here
./boost/date_time/gregorian/formatters.hpp:65:125: internal compiler error: in tsubst_copy, at cp/pt.c:10664
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Reducing.
Comment 4 Richard Biener 2010-01-12 14:30:24 UTC
Created attachment 19549 [details]
reduced testcase
Comment 5 Manuel López-Ibáñez 2010-01-13 00:21:29 UTC
The code warning:

155347      jason   user_args = args == NULL ? NULL : *args;
155347      jason   /* Under DR 147 A::A() is an invalid constructor call,
155347      jason      not a functional cast.  */
155347      jason   if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn))
155347      jason     {
155347      jason       if (! (complain & tf_error))
155347      jason       return error_mark_node;
155347      jason
155347      jason       permerror (input_location,
155347      jason                "cannot call constructor %<%T::%D%> directly",
155347      jason                basetype, name);
155347      jason       inform (input_location, "for a function-style cast, remove the "
155347      jason             "redundant %<::%D%>", name);
155347      jason       call = build_functional_cast (basetype, build_tree_list_vec (user_args),
155347      jason                                   complain);
155347      jason       release_tree_vector (user_args);
155347      jason       return call;
155347      jason     }

To avoid the spurious note, the code should use the idiom permerror() && inform(), since diagnostics functions that may be suppressed return false if they don't print anything.
Comment 6 H.J. Lu 2010-01-13 17:43:09 UTC
This is caused by revision 155347:

http://gcc.gnu.org/ml/gcc-cvs/2009-12/msg00491.html
Comment 7 H.J. Lu 2010-01-13 17:44:18 UTC
*** Bug 42725 has been marked as a duplicate of this bug. ***
Comment 8 Richard Biener 2010-01-14 10:14:22 UTC
Reduced testcase from PR42725:

namespace Glib {
    class ustring {
    public:
        typedef unsigned size_type;
        ustring(const char* src, size_type n);
        ustring(const char* src);
    };
}
namespace Gdk {
    class Color {
    public:
        explicit Color(const Glib::ustring& value);
    };
}
namespace Gtk {
    enum StateType { STATE_NORMAL };
    class Widget   {
    public:
        void modify_bg(StateType state, const Gdk::Color& color);
    };
    class Label {
    public:
        void set_text(const Glib::ustring &str);
    };
}
typedef enum Result { eSuccess = 0 } Result;
class MainWindow  {
    void update_status(Result result);
    Gtk::Widget status_frame;
    Gtk::Label status_label;
};
void MainWindow::update_status(Result result) {
    switch (result) {
        status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("green"));
        status_frame.modify_bg(Gtk::STATE_NORMAL,Gdk::Color::Color("red"));
        status_label.set_text("Out of memory");
    }
}
Comment 9 Jason Merrill 2010-01-14 22:32:48 UTC
Subject: Bug 42701

Author: jason
Date: Thu Jan 14 22:32:24 2010
New Revision: 155916

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155916
Log:
	PR c++/42701
	* call.c (build_new_method_call): Don't free the vec here.

Added:
    trunk/gcc/testsuite/g++.dg/overload/error3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog

Comment 10 Jason Merrill 2010-01-14 22:34:00 UTC
Fixed.
Comment 11 Jason Merrill 2010-01-15 06:18:22 UTC
*** Bug 42569 has been marked as a duplicate of this bug. ***