diff mbox series

Fix PR libgcc/92988

Message ID 84d60d5f-6d39-ae55-9fb2-a95674b32197@bell.net
State New
Headers show
Series Fix PR libgcc/92988 | expand

Commit Message

John David Anglin Dec. 30, 2019, 7:23 p.m. UTC
Tested on hppa64-hp-hpux11.11.

Okay?

Dave

2019-12-30  John David Anglin  <danglin@gcc.gnu.org>

	PR libgcc/92988
	* crtstuff.c (__do_global_dtors_aux): Only call __cxa_finalize if
	DEFAULT_USE_CXA_ATEXIT is true.

Comments

John David Anglin Jan. 1, 2020, 5:23 p.m. UTC | #1
This bug was introduced by the following change:
https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00766.html

On 2019-12-30 2:23 p.m., John David Anglin wrote:
> Tested on hppa64-hp-hpux11.11.
>
> Okay?
>
> Dave
>
> 2019-12-30  John David Anglin  <danglin@gcc.gnu.org>
>
> 	PR libgcc/92988
> 	* crtstuff.c (__do_global_dtors_aux): Only call __cxa_finalize if
> 	DEFAULT_USE_CXA_ATEXIT is true.
>
> Index: crtstuff.c
> ===================================================================
> --- crtstuff.c	(revision 279736)
> +++ crtstuff.c	(working copy)
> @@ -382,10 +382,12 @@
>    if (__builtin_expect (completed, 0))
>      return;
>
> +#if DEFAULT_USE_CXA_ATEXIT
>  #ifdef CRTSTUFFS_O
>    if (__cxa_finalize)
>      __cxa_finalize (__dso_handle);
>  #endif
> +#endif
>
>  #ifdef FINI_ARRAY_SECTION_ASM_OP
>    /* If we are using .fini_array then destructors will be run via that
>
Jeff Law Jan. 15, 2020, 8:45 p.m. UTC | #2
On Mon, 2019-12-30 at 14:23 -0500, John David Anglin wrote:
> Tested on hppa64-hp-hpux11.11.
> 
> Okay?
> 
> Dave
> 
> 2019-12-30  John David Anglin  <danglin@gcc.gnu.org>
> 
> 	PR libgcc/92988
> 	* crtstuff.c (__do_global_dtors_aux): Only call __cxa_finalize if
> 	DEFAULT_USE_CXA_ATEXIT is true.
Who is supposed to define DEFAULT_USE_CXA_ATEXIT?  I can't seem to find
any references to it within GCC itself.

I don't doubt there's a problem, I'm just not sure we've got the right
#ifdef around the code in question.

Jeff

>
John David Anglin Jan. 15, 2020, 10:27 p.m. UTC | #3
On 2020-01-15 3:45 p.m., Jeff Law wrote:
> On Mon, 2019-12-30 at 14:23 -0500, John David Anglin wrote:
>> Tested on hppa64-hp-hpux11.11.
>>
>> Okay?
>>
>> Dave
>>
>> 2019-12-30  John David Anglin  <danglin@gcc.gnu.org>
>>
>> 	PR libgcc/92988
>> 	* crtstuff.c (__do_global_dtors_aux): Only call __cxa_finalize if
>> 	DEFAULT_USE_CXA_ATEXIT is true.
> Who is supposed to define DEFAULT_USE_CXA_ATEXIT?  I can't seem to find
> any references to it within GCC itself.
>
> I don't doubt there's a problem, I'm just not sure we've got the right
> #ifdef around the code in question.
It is defined by configure.  In gcc/defaults.h:

/* Determine whether __cxa_atexit, rather than atexit, is used to
   register C++ destructors for local statics and global objects.  */
#ifndef DEFAULT_USE_CXA_ATEXIT
#define DEFAULT_USE_CXA_ATEXIT 0
#endif

Dave
Jeff Law Jan. 15, 2020, 10:32 p.m. UTC | #4
On Wed, 2020-01-15 at 17:27 -0500, John David Anglin wrote:
> On 2020-01-15 3:45 p.m., Jeff Law wrote:
> > On Mon, 2019-12-30 at 14:23 -0500, John David Anglin wrote:
> > > Tested on hppa64-hp-hpux11.11.
> > > 
> > > Okay?
> > > 
> > > Dave
> > > 
> > > 2019-12-30  John David Anglin  <danglin@gcc.gnu.org>
> > > 
> > > 	PR libgcc/92988
> > > 	* crtstuff.c (__do_global_dtors_aux): Only call __cxa_finalize if
> > > 	DEFAULT_USE_CXA_ATEXIT is true.
> > Who is supposed to define DEFAULT_USE_CXA_ATEXIT?  I can't seem to find
> > any references to it within GCC itself.
> > 
> > I don't doubt there's a problem, I'm just not sure we've got the right
> > #ifdef around the code in question.
> It is defined by configure.  In gcc/defaults.h:
> 
> /* Determine whether __cxa_atexit, rather than atexit, is used to
>    register C++ destructors for local statics and global objects.  */
> #ifndef DEFAULT_USE_CXA_ATEXIT
> #define DEFAULT_USE_CXA_ATEXIT 0
> #endif
Uber-weird. I grepped for it more than once and didn't see anything.  

Thanks.  OK for the trunk.
jeff
diff mbox series

Patch

Index: crtstuff.c
===================================================================
--- crtstuff.c	(revision 279736)
+++ crtstuff.c	(working copy)
@@ -382,10 +382,12 @@ 
   if (__builtin_expect (completed, 0))
     return;

+#if DEFAULT_USE_CXA_ATEXIT
 #ifdef CRTSTUFFS_O
   if (__cxa_finalize)
     __cxa_finalize (__dso_handle);
 #endif
+#endif

 #ifdef FINI_ARRAY_SECTION_ASM_OP
   /* If we are using .fini_array then destructors will be run via that