Bug#144232: g++-3.0: exception handling doesn't work with -O flags
retitle 144232 [fixed in g++-3.1] exception handling doesn't work with -O flags
tags 144232 + fixed
thanks
I am unable to reproduce this with g++-3.0 and g++-3.1. With g++-2.95
it is reproduceible. (tried the example with -g -O2)
Zdenek Kabelac writes:
> Package: g++-3.0
> Version: 1:3.0.4-7
> Severity: normal
>
> Hello
>
> I'm adding my sample program which demonstrate that C++
> program is unusable with -O2 (or better compilation)
> moreover it seems to be also affected by march=i5/686 flag
>
> check out 524000 iteration
>
> you may lower the char array a[10] - in that case it will
> pass the test with -O2 & stack-check
>
> It looks like the bug is in all gcc compilers I could check
> (and it's very annoying for me as avifile developer - basicaly
> I've to compile avifile C++ part without any -O2 flags otherwice
> unexpected mystery abort are appearing becuase of uncatched exception)
>
> (Do I have to repost this bug for 2.95 as well - though in that
> case even lowering a[a] doesn't help - only -fno-deferer-pop
> but still I do get craches with march option
>
>
>
> /*
> * rm test; CXXFLAGS=" -g -O2" make test
> * - note the major speedup when throw(exception) isn't specified
> * - with -O2 it will crash after 524000 iterations
> *
> * the minimum problematic option is: -fdefer-pop
> * to immediately hit the bug use: -fstack-check
> *
> * bug is visible with all GCC compilers I know
> */
> #include <cstdio>
>
> struct myexcept { char a[10000]; };
> class testcl { public: testcl() { throw myexcept(); } };
>
> int main(int argc, char** argv)
> {
> volatile unsigned char a[128];
> //for (int i = 0; i < sizeof(a); i++) a[i] = i & 0xff;
>
> for (int i = 0; ; i++)
> {
> testcl* c = 0;
> //for (int j = sizeof(a) - 1; j > sizeof(a) - 32; j--) printf("%3d .. %3d\n", j, a[j]);
> try { c = new testcl(); }
> catch (...) { if ((i % 1000) == 0) printf("%d : %p\n", i, c); }
> delete c;
> }
> }
>
> -- System Information
> Debian Release: 3.0
> Architecture: i386
> Kernel: Linux dual 2.4.19-pre6 #3 SMP Po dub 8 21:37:32 CEST 2002 i686
> Locale: LANG=cs_CZ, LC_CTYPE=cs_CZ
>
> Versions of packages g++-3.0 depends on:
> ii gcc-3.0 1:3.0.4-7 The GNU C compiler.
> ii gcc-3.0-base 1:3.0.4-7 The GNU Compiler Collection (base
> ii libc6 2.2.5-4 GNU C Library: Shared libraries an
> ii libstdc++3-dev 1:3.0.4-7 The GNU stdc++ library version 3 (
>
>
>
> --
> To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
--
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: