Opened 7 years ago

Last modified 4 years ago

#40853 assigned defect

gcc43, gcc44: g++ is broken wrt exception handling

Reported by: akimd (Akim Demaille) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.2.0
Keywords: Cc:
Port: gcc43 gcc44

Description

Hi,

First a disclaimer: I _think_ that this used to work before, but no longer does. I tend to think that it used to work, because the test suite of Bison was all green a few months back, but today there are fails because of the following failure. It might have something to do with the libgcc changes, but I could not find an "obsolete" machine on which I could check this.

And also, I understand that these compilers are old.

On the following test case:

#include <iostream>
#include <stdexcept>

void foo()
{
  try
    {
      throw std::runtime_error("foo");
    }
  catch (...)
    {
      std::cerr << "Inner caught" << std::endl;
      throw;
    }
}

int main()
{
  try
    {
      foo();
    }
  catch (...)
    {
      std::cerr << "Outer caught unknown" << std::endl;
    }
}

neither g++-mp-4.3 nor 4.4 produce a functioning executable:

$ g++-mp-4.3 exc.cc && ./a.out
Inner caught
zsh: abort      ./a.out
$ g++-mp-4.4 exc.cc && ./a.out
Inner caught
zsh: abort      ./a.out
$ g++-mp-4.5 exc.cc && ./a.out
Inner caught
Outer caught unknown
$ g++-mp-4.6 exc.cc && ./a.out
Inner caught
Outer caught unknown
$ g++-mp-4.7 exc.cc && ./a.out
Inner caught
Outer caught unknown
$ g++-mp-4.8 exc.cc && ./a.out
Inner caught
Outer caught unknown
$ g++-mp-4.9 exc.cc && ./a.out
Inner caught
Outer caught unknown
$  exc.cc && ./a.out

I'm using libgcc-devel, but trying with libgcc didn't change.

Change History (3)

comment:1 Changed 7 years ago by ryandesign (Ryan Schmidt)

Owner: changed from macports-tickets@… to mww@…
Summary: g++ 4.3 and 4.4 are broken wrt exception handlinggcc43, gcc44: g++ is broken wrt exception handling

Then I might suggest that you simply use newer versions of gcc that don't have this problem. I doubt the developers of gcc are still releasing updates for gcc43 or gcc44.

comment:2 Changed 7 years ago by akimd (Akim Demaille)

Yes, of course I can :) But then again, because I maintain free software, I need to run as many compilers as I can to ensure that I avoid stupid portability issues. And yes, I do not expect gcc people to fix such old compilers. But I was under the impression that these compilers used to work on MacPorts.

I'll try to find a GNU/Linux box with these compilers installed.

comment:3 Changed 4 years ago by kurthindenburg (Kurt Hindenburg)

Owner: changed from mww@… to macports-tickets@…
Status: newassigned
Note: See TracTickets for help on using tickets.