public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11813] New: Make GCC not to assume that C functions can't throw.
@ 2003-08-05 22:53 v dot haisman at sh dot cvut dot cz
  2003-08-05 22:54 ` [Bug c++/11813] " v dot haisman at sh dot cvut dot cz
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: v dot haisman at sh dot cvut dot cz @ 2003-08-05 22:53 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Make GCC not to assume that C functions can't throw.
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: v dot haisman at sh dot cvut dot cz
                CC: gcc-bugs at gcc dot gnu dot org,v dot haisman at sh dot
                    cvut dot cz
 GCC build triplet: *-*-*
  GCC host triplet: *-*-*
GCC target triplet: *-*-*

This test case shows that C++ exceptions are not caught across C function calls.
Although this can be cured by supplying -fexceptions for compilation of C files,
it is not always possible solution. For example when the program is linked with
third party's binary C library whose compilation flags can't be controled.
MSVC++ allows user to specify option /EHsc- that enables exceptions and also
stops the compiler from assuming that C functions can't throw. I think that some
users of GCC would like to have similar flag too.


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

* [Bug c++/11813] Make GCC not to assume that C functions can't throw.
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
@ 2003-08-05 22:54 ` v dot haisman at sh dot cvut dot cz
  2003-08-05 22:55 ` v dot haisman at sh dot cvut dot cz
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: v dot haisman at sh dot cvut dot cz @ 2003-08-05 22:54 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From v dot haisman at sh dot cvut dot cz  2003-08-05 22:54 -------
Created an attachment (id=4565)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4565&action=view)
build.sh


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

* [Bug c++/11813] Make GCC not to assume that C functions can't throw.
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
  2003-08-05 22:54 ` [Bug c++/11813] " v dot haisman at sh dot cvut dot cz
  2003-08-05 22:55 ` v dot haisman at sh dot cvut dot cz
@ 2003-08-05 22:55 ` v dot haisman at sh dot cvut dot cz
  2003-08-05 22:56 ` v dot haisman at sh dot cvut dot cz
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: v dot haisman at sh dot cvut dot cz @ 2003-08-05 22:55 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From v dot haisman at sh dot cvut dot cz  2003-08-05 22:55 -------
Created an attachment (id=4566)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4566&action=view)
libx.h


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

* [Bug c++/11813] Make GCC not to assume that C functions can't throw.
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
  2003-08-05 22:54 ` [Bug c++/11813] " v dot haisman at sh dot cvut dot cz
@ 2003-08-05 22:55 ` v dot haisman at sh dot cvut dot cz
  2003-08-05 22:55 ` v dot haisman at sh dot cvut dot cz
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: v dot haisman at sh dot cvut dot cz @ 2003-08-05 22:55 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From v dot haisman at sh dot cvut dot cz  2003-08-05 22:55 -------
Created an attachment (id=4567)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4567&action=view)
libx.c


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

* [Bug c++/11813] Make GCC not to assume that C functions can't throw.
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
                   ` (2 preceding siblings ...)
  2003-08-05 22:55 ` v dot haisman at sh dot cvut dot cz
@ 2003-08-05 22:56 ` v dot haisman at sh dot cvut dot cz
  2003-08-05 23:16 ` [Bug other/11813] " pinskia at physics dot uc dot edu
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: v dot haisman at sh dot cvut dot cz @ 2003-08-05 22:56 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From v dot haisman at sh dot cvut dot cz  2003-08-05 22:56 -------
Created an attachment (id=4568)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4568&action=view)
main.cpp


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

* [Bug other/11813] Make GCC not to assume that C functions can't throw.
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
                   ` (3 preceding siblings ...)
  2003-08-05 22:56 ` v dot haisman at sh dot cvut dot cz
@ 2003-08-05 23:16 ` pinskia at physics dot uc dot edu
  2003-08-05 23:42 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 23:16 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
          Component|c++                         |other


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-05 23:16 -------
I think the current consensus is to enable -fexceptions all the time since pthread_kill callbacks will 
use exceptions but I could be wrong.
Also -fexceptions sounds like the same as /EHsc- but I could be wrong there.

The current problem with enabling -fexceptions all the time it adds size overhead in the case of 
dwarf2 exceptions and size and time overhead in the case of setjmp/longjmp exceptions.


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

* [Bug other/11813] Make GCC not to assume that C functions can't throw.
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
                   ` (4 preceding siblings ...)
  2003-08-05 23:16 ` [Bug other/11813] " pinskia at physics dot uc dot edu
@ 2003-08-05 23:42 ` bangerth at dealii dot org
  2003-08-06  7:29 ` gdr at integrable-solutions dot net
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2003-08-05 23:42 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Priority|P2                          |P3
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-05 23:42:54
               date|                            |
   Target Milestone|3.4                         |---
            Version|3.3.1                       |3.4


------- Additional Comments From bangerth at dealii dot org  2003-08-05 23:42 -------
I can confirm this. However, I personally think that if you want to make
this happen (i.e. want to propagate C++ exceptions through C code), then
you should have to pay the price of giving -fexceptions to the command
line.


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

* [Bug other/11813] Make GCC not to assume that C functions can't throw.
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
                   ` (5 preceding siblings ...)
  2003-08-05 23:42 ` bangerth at dealii dot org
@ 2003-08-06  7:29 ` gdr at integrable-solutions dot net
  2003-08-06  7:33 ` gdr at integrable-solutions dot net
  2005-01-25 16:13 ` [Bug c/11813] make -fexceptions default for c and objective-c pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-08-06  7:29 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gdr at integrable-solutions dot net  2003-08-06 07:29 -------
Subject: Re:  New: Make GCC not to assume that C functions can't throw.


the proper way (for users) to handle this is to compile C code with
-fexceptions.  But yes, that is VERY inconvenient because it requires
foeresight to know that a C function won't use a callback from C++
code.  That is sad.


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

* [Bug other/11813] Make GCC not to assume that C functions can't throw.
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
                   ` (6 preceding siblings ...)
  2003-08-06  7:29 ` gdr at integrable-solutions dot net
@ 2003-08-06  7:33 ` gdr at integrable-solutions dot net
  2005-01-25 16:13 ` [Bug c/11813] make -fexceptions default for c and objective-c pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: gdr at integrable-solutions dot net @ 2003-08-06  7:33 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From gdr at integrable-solutions dot net  2003-08-06 07:33 -------
Subject: Re:  Make GCC not to assume that C functions can't throw.

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| I can confirm this. However, I personally think that if you want to make
| this happen (i.e. want to propagate C++ exceptions through C code), then
| you should have to pay the price of giving -fexceptions to the command
| line.

However, that way of doing things require more foresight you can
imagine.  Imagine an X11 library compiled as plain C source with
-fno-exceptions. That library cannot be used reliebly by a C++
programs because if it provides a callback (with C linkage) that might
throw directly of indirectly (most frequent), GCC will not propagate
that exception properly to the program. It will just abort.  That is
an unfortunate situation.

-- Gaby


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

* [Bug c/11813] make -fexceptions default for c and objective-c
  2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
                   ` (7 preceding siblings ...)
  2003-08-06  7:33 ` gdr at integrable-solutions dot net
@ 2005-01-25 16:13 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-25 16:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-25 16:11 -------
*** Bug 19620 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jkanze at cheuvreux dot com


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


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

end of thread, other threads:[~2005-01-25 16:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-05 22:53 [Bug c++/11813] New: Make GCC not to assume that C functions can't throw v dot haisman at sh dot cvut dot cz
2003-08-05 22:54 ` [Bug c++/11813] " v dot haisman at sh dot cvut dot cz
2003-08-05 22:55 ` v dot haisman at sh dot cvut dot cz
2003-08-05 22:55 ` v dot haisman at sh dot cvut dot cz
2003-08-05 22:56 ` v dot haisman at sh dot cvut dot cz
2003-08-05 23:16 ` [Bug other/11813] " pinskia at physics dot uc dot edu
2003-08-05 23:42 ` bangerth at dealii dot org
2003-08-06  7:29 ` gdr at integrable-solutions dot net
2003-08-06  7:33 ` gdr at integrable-solutions dot net
2005-01-25 16:13 ` [Bug c/11813] make -fexceptions default for c and objective-c 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).