https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65344

Bernard Ladenthin <bernard.ladenthin at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernard.ladenthin at gmail dot 
com

--- Comment #2 from Bernard Ladenthin <bernard.ladenthin at gmail dot com> ---
Fixed by the collect2 patch proposed in PR 60939 ("AIX: exceptions not caught
when calling function via pointer").  Tested with attachment 34983, unmodified.

AIX 7.3, GCC 17.0.0 built from master, linked twice with the two collect2
binaries produced from that same tree.  Nothing else differed.

  no patch: Called doThrow.
            terminate called after throwing an instance of 'Exception'

  patched:  Called doThrow.
            Thrown && catched BaseException.
            End.

The first is byte-for-byte the main-output.txt in the attachment.

Same root cause, and the sources say so themselves: throwing_class.cc carries
the comment "This class must be in separate object file", and its registrator
publishes the pointer from a static constructor, so nothing references that
translation unit during collect2's first link.  The AIX linker discards the
csect together with its EH frame table and the handler is never found.  That is
also why uncommenting the block in main.cc makes case 2 work -- the direct
reference keeps the unit alive.

Looks like a duplicate of PR 60939 to me, but I will leave that call to a
maintainer.

Reply via email to