public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
@ 2004-05-26 23:56 rajanba at nortelnetworks dot com
2004-05-27 3:50 ` [Bug target/15662] " pinskia at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: rajanba at nortelnetworks dot com @ 2004-05-26 23:56 UTC (permalink / raw)
To: gcc-bugs
Consider the following:
#include <iostream.h>
class Exception{
public:
Exception() {}
~Exception() {}
};
std::string foo(bool throwException)
{
if( throwException ) {
throw Exception();
} else {
std:: string x = "hello world";
return x;
}
}
int main(int argc, char** argv)
{
try {
const std::string & str = foo(true);
} catch(...) {
cout << "Caught an exception" << endl;
}
return 0;
}
Compiled it for POWERPC target and upon execution, it segmentation faults and
dumps a core. From the core, it is trying to delete the std::string object
pointed at by str (reference to string to be returned from foo) while unwinding
the stack.
The same results are obtained if any of the STL classes are used.
Everything works fine on x86 targets.
It seems that the gcc compiler is breaching ISO/ISE 14882:2003 12.2/5 upon
throw of an exception.
Thanks
--
Summary: Segmentation fault (POWERPC ) when an exception is
thrown - even if try catch is specified
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: critical
Priority: P1
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rajanba at nortelnetworks dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/15662] Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
@ 2004-05-27 3:50 ` pinskia at gcc dot gnu dot org
2004-05-27 4:33 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-27 3:50 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-26 14:19 -------
How is gcc configured?
And which PPC target, linux, or just elf?
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|UNCONFIRMED |WAITING
Component|c++ |target
Keywords| |wrong-code
Summary|Segmentation fault (POWERPC |Segmentation fault (POWERPC
|) when an exception is |) when an exception is
|thrown - even if try catch |thrown - even if try catch
|is specified |is specified
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/15662] Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
2004-05-27 3:50 ` [Bug target/15662] " pinskia at gcc dot gnu dot org
@ 2004-05-27 4:33 ` pinskia at gcc dot gnu dot org
2004-05-27 5:09 ` bangerth at dealii dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-27 4:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-26 14:23 -------
I am going to assume eabi, if not please reopen this bug, other wise this is a dup of bug 10778 which I
am closing this one.
*** This bug has been marked as a duplicate of 10778 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/15662] Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
2004-05-27 3:50 ` [Bug target/15662] " pinskia at gcc dot gnu dot org
2004-05-27 4:33 ` pinskia at gcc dot gnu dot org
@ 2004-05-27 5:09 ` bangerth at dealii dot org
2004-05-27 7:45 ` rajanba at nortelnetworks dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-05-27 5:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-05-26 14:26 -------
BTW, you are trying to bind the const reference to a temporary. That
doesn't sound very good...
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/15662] Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
` (2 preceding siblings ...)
2004-05-27 5:09 ` bangerth at dealii dot org
@ 2004-05-27 7:45 ` rajanba at nortelnetworks dot com
2004-05-27 8:51 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rajanba at nortelnetworks dot com @ 2004-05-27 7:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rajanba at nortelnetworks dot com 2004-05-26 14:38 -------
It is not the same as 10778. Host is linux on powerpc target machine. Compiled
with options:
-DLINUX -D_SVID_SOURCE=1 -D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_GNU_SOURCE=1
-mpowerpc -pthread
As per ISO/ISE 14882:2003 12.2/5, when a reference is bound to temporary, the
temporrary remains in scope till the reference is in scope. It would seem that
the gcc 3.3.1 tries to delete the temporary object refered to by a const
reference upon unwinding the stack - when it should not be attempting to delete
that object.
IMPORTANT NOTE: Happens only when STL is involved and on POWERPC only.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
GCC host triplet| |linux
GCC target triplet| |PowerPC
Resolution|DUPLICATE |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/15662] Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
` (3 preceding siblings ...)
2004-05-27 7:45 ` rajanba at nortelnetworks dot com
@ 2004-05-27 8:51 ` pinskia at gcc dot gnu dot org
2004-05-27 9:24 ` bangerth at dealii dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-27 8:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-26 15:03 -------
I should note this works on powerpc-apple-darwin.
--
What |Removed |Added
----------------------------------------------------------------------------
GCC host triplet|linux |
GCC target triplet|PowerPC |powerpc-*-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/15662] Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
` (4 preceding siblings ...)
2004-05-27 8:51 ` pinskia at gcc dot gnu dot org
@ 2004-05-27 9:24 ` bangerth at dealii dot org
2004-06-10 12:24 ` amodra at bigpond dot net dot au
2004-06-10 13:07 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-05-27 9:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2004-05-26 15:53 -------
As Rajan correctly points out, the code is valid of course. Sorry for the
confusing.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/15662] Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
` (5 preceding siblings ...)
2004-05-27 9:24 ` bangerth at dealii dot org
@ 2004-06-10 12:24 ` amodra at bigpond dot net dot au
2004-06-10 13:07 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: amodra at bigpond dot net dot au @ 2004-06-10 12:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amodra at bigpond dot net dot au 2004-06-10 12:24 -------
testcase passes with 3.3-hammer, 3.4.1 and 3.5.0 powerpc-linux and powerpc64-linux
--
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |3.4.1 3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug target/15662] Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
` (6 preceding siblings ...)
2004-06-10 12:24 ` amodra at bigpond dot net dot au
@ 2004-06-10 13:07 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-10 13:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-06-10 13:07 -------
Closing as fixed then.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |3.4.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15662
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2004-06-10 13:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-26 23:56 [Bug c++/15662] New: Segmentation fault (POWERPC ) when an exception is thrown - even if try catch is specified rajanba at nortelnetworks dot com
2004-05-27 3:50 ` [Bug target/15662] " pinskia at gcc dot gnu dot org
2004-05-27 4:33 ` pinskia at gcc dot gnu dot org
2004-05-27 5:09 ` bangerth at dealii dot org
2004-05-27 7:45 ` rajanba at nortelnetworks dot com
2004-05-27 8:51 ` pinskia at gcc dot gnu dot org
2004-05-27 9:24 ` bangerth at dealii dot org
2004-06-10 12:24 ` amodra at bigpond dot net dot au
2004-06-10 13:07 ` pinskia at gcc dot gnu dot 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).