Bug 29443 - [4.1 Regression] ICE: output_operand: invalid expression as operand with -gstabs
Summary: [4.1 Regression] ICE: output_operand: invalid expression as operand with -gstabs
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.2
: P2 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 30472 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-10-12 19:58 UTC by Martin Michlmayr
Modified: 2008-07-04 15:52 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-linux-gnu
Build:
Known to work: 3.3.3 4.2.0
Known to fail: 4.1.2 4.1.3
Last reconfirmed: 2006-10-23 06:47:45


Attachments
testcase (1.74 KB, text/plain)
2006-10-12 19:58 UTC, Martin Michlmayr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-10-12 19:58:09 UTC
I get the following ICE with -gstabs with gcc 4.1.2 20060901 (Debian 4.1.1-13) but not with 4.0 and 4.2.


(sid)1186:tbm@em64t: ~] g++-4.1 -O -fPIC -gstabs libapt-front-state.cpp
libapt-front-state.cpp: In member function ‘std::string aptFront::cache::component::State::sizeString(double)’:
libapt-front-state.cpp:336: internal compiler error: output_operand: invalid expression as operand
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/ccgRM3uh.out file, please attach this to your bugreport.
(sid)1187:tbm@em64t: ~]
Comment 1 Martin Michlmayr 2006-10-12 19:58:50 UTC
Created attachment 12421 [details]
testcase
Comment 2 Andrew Pinski 2006-10-13 02:44:25 UTC
This works on 4.1.2 20061007 on i686-linux-gnu.
Comment 3 Martin Michlmayr 2006-10-13 08:05:49 UTC
(In reply to comment #2)
> This works on 4.1.2 20061007 on i686-linux-gnu.

Fails for me with gcc 4.1.2 20061011 on x86_64-unknown-linux-gnu.  From the Debian build logs it seems the ICE only appeared on x86_64.
Comment 4 Andrew Pinski 2006-10-23 04:02:56 UTC
This is TLS that is being ICEd on so I doubt this is a regression, except for libstdc++ using TLS now.
Comment 5 Andrew Pinski 2006-10-23 04:15:21 UTC
Sorry, not TLS but instead some PIC code.  This is a target specific issue.
Comment 6 Andrew Pinski 2006-10-23 06:39:01 UTC
(gdb) p debug_rtx(x)
(unspec:DI [
        (symbol_ref:DI ("_ZN6string20_S_empty_rep_storageE") [flags 0x40] <var_decl 0xb7d9c060 _S_empty_rep_storage>)
    ] 2)
Comment 7 Andrew Pinski 2006-10-23 06:47:44 UTC
Reduced testcase:
struct string
{
    struct _Rep{}; static _Rep _S_empty_rep_storage[];
    void *_M_rep () const{} void _M_destroy () throw ();
    ~string ()
    {
	_Rep  *a = (_Rep *)((void *)(&_S_empty_rep_storage));
	if (__builtin_expect (_M_rep ()!= a, false)) _M_destroy ();
    }
};
struct ios_base { virtual ~ ios_base (); }; struct ostream : virtual ios_base{};
struct stringbuf 
{
    int t()const; string _M_string;
    string str () const
    {
      string __ret;
      if (t()) return __ret;
    }
};
struct ostringstream : ostream { ostream   __ostream_type;  stringbuf _M_stringbuf; };
void sizeString ()
{
  ostringstream s;
 s._M_stringbuf.str ();
}
Comment 8 Andrew Pinski 2006-10-23 06:48:10 UTC
Note this looks like a latent bug.
Comment 9 Richard Biener 2007-04-22 18:29:40 UTC
*** Bug 30472 has been marked as a duplicate of this bug. ***
Comment 10 Joseph S. Myers 2008-07-04 15:52:52 UTC
Closing 4.1 branch.