public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/60221] New: gcc -fexceptions generates unnecessary cleanup code
@ 2014-02-16  3:46 redlizard at redlizard dot nl
  2014-02-16  4:55 ` [Bug middle-end/60221] " pinskia at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: redlizard at redlizard dot nl @ 2014-02-16  3:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60221
           Summary: gcc -fexceptions generates unnecessary cleanup code
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redlizard at redlizard dot nl

> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/tmp/gcc-4.8.2/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.2/configure --prefix=/tmp/gcc-4.8.2
--enable-languages=c,c++
Thread model: posix
gcc version 4.8.2 (GCC)


> cat test.c
void bar(void);
void foo(void)
{
  struct { int x; } y;
  bar();
}


When compiled with `gcc -fexceptions -O0 -c test.c`, the above code generates
cleanup code for stack unwinding purposes, referencing __gcc_personality_v0;
this necessitates linking with shared-libgcc.

I am not sure this is really a bug, but versions of gcc older than 4.7 do not
generate cleanup code for this example; neither does gcc 4.8 when the local
variable is replaced by `int y;`. Moreover, according to the gcc documentation,
there are "several situations" (I have been unable to find more a detailed
specification) in which linking with shared-libgcc is necessary, which includes
code throwing or catching exceptions, but should -- as far as I can see --
*not* include c code just passing through exceptions.

Tested on x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu -m32, and
i386-pc-solaris2.11, using gcc 4.7.1, 4.7.3, and 4.8.2. gcc 4.6.4 and earlier
tested versions are not affected. I have been unable to test gcc 4.7.0.


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

end of thread, other threads:[~2014-05-23  8:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-16  3:46 [Bug c/60221] New: gcc -fexceptions generates unnecessary cleanup code redlizard at redlizard dot nl
2014-02-16  4:55 ` [Bug middle-end/60221] " pinskia at gcc dot gnu.org
2014-02-17 12:32 ` [Bug middle-end/60221] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2014-02-17 15:41 ` jakub at gcc dot gnu.org
2014-02-18 10:41 ` rguenth at gcc dot gnu.org
2014-02-20  9:01 ` rguenth at gcc dot gnu.org
2014-02-20 22:09 ` [Bug middle-end/60221] [4.7/4.8 " redlizard at redlizard dot nl
2014-02-21  9:16 ` rguenther at suse dot de
2014-02-25 10:47 ` rguenth at gcc dot gnu.org
2014-02-25 10:48 ` [Bug middle-end/60221] [4.7 " rguenth at gcc dot gnu.org
2014-03-09 19:00 ` pinskia at gcc dot gnu.org
2014-05-23  8:27 ` rguenth at gcc dot gnu.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).