public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Don't call fatal_error before error reporting has been initialized.
@ 2014-09-29 14:03 Ilya Tocar
  2014-10-09 11:48 ` Ilya Tocar
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Tocar @ 2014-09-29 14:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bernd Schmidt

Hi,

Currently if call to atexit (lto_wrapper_cleanup) fails we
won't report error as we haven't initialized error-reporting
infrastructure. This patch moves this call after diagnostic_initialize.
I hope that we can't  exit inside diagnostic_initialize. Otherwise we
won't cleanup after it.
Ok for trunk?

2014-09-29  Ilya Tocar  <ilya.tocar@intel.com>

	* lto-wrapper.c (main): Don't call fatal_error before
	diagnostic_initialize.
---
 gcc/lto-wrapper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 08fd090..39e13b8 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -870,13 +870,13 @@ main (int argc, char *argv[])
 
   xmalloc_set_program_name (progname);
 
-  if (atexit (lto_wrapper_cleanup) != 0)
-    fatal_error ("atexit failed");
-
   gcc_init_libintl ();
 
   diagnostic_initialize (global_dc, 0);
 
+  if (atexit (lto_wrapper_cleanup) != 0)
+    fatal_error ("atexit failed");
+
   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
     signal (SIGINT, fatal_signal);
 #ifdef SIGHUP
-- 
1.8.3.1

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

* Re: [PATCH] Don't call fatal_error before error reporting has been initialized.
  2014-09-29 14:03 [PATCH] Don't call fatal_error before error reporting has been initialized Ilya Tocar
@ 2014-10-09 11:48 ` Ilya Tocar
  2014-10-20 15:27   ` Ilya Tocar
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Tocar @ 2014-10-09 11:48 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bernd Schmidt

Ping.

On 29 Sep 18:02, Ilya Tocar wrote:
> Hi,
> 
> Currently if call to atexit (lto_wrapper_cleanup) fails we
> won't report error as we haven't initialized error-reporting
> infrastructure. This patch moves this call after diagnostic_initialize.
> I hope that we can't  exit inside diagnostic_initialize. Otherwise we
> won't cleanup after it.
> Ok for trunk?
> 
> 2014-09-29  Ilya Tocar  <ilya.tocar@intel.com>
> 
> 	* lto-wrapper.c (main): Don't call fatal_error before
> 	diagnostic_initialize.
> ---
>  gcc/lto-wrapper.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
> index 08fd090..39e13b8 100644
> --- a/gcc/lto-wrapper.c
> +++ b/gcc/lto-wrapper.c
> @@ -870,13 +870,13 @@ main (int argc, char *argv[])
>  
>    xmalloc_set_program_name (progname);
>  
> -  if (atexit (lto_wrapper_cleanup) != 0)
> -    fatal_error ("atexit failed");
> -
>    gcc_init_libintl ();
>  
>    diagnostic_initialize (global_dc, 0);
>  
> +  if (atexit (lto_wrapper_cleanup) != 0)
> +    fatal_error ("atexit failed");
> +
>    if (signal (SIGINT, SIG_IGN) != SIG_IGN)
>      signal (SIGINT, fatal_signal);
>  #ifdef SIGHUP
> -- 
> 1.8.3.1
> 

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

* Re: [PATCH] Don't call fatal_error before error reporting has been initialized.
  2014-10-09 11:48 ` Ilya Tocar
@ 2014-10-20 15:27   ` Ilya Tocar
  2014-11-05 16:03     ` [PING][PATCH] " Ilya Tocar
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Tocar @ 2014-10-20 15:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bernd Schmidt

Same in collect2.

On 09 Oct 15:40, Ilya Tocar wrote:
> Ping.
> 
> On 29 Sep 18:02, Ilya Tocar wrote:
> > Hi,
> > 
> > Currently if call to atexit (lto_wrapper_cleanup) fails we
> > won't report error as we haven't initialized error-reporting
> > infrastructure. This patch moves this call after diagnostic_initialize.
> > I hope that we can't  exit inside diagnostic_initialize. Otherwise we
> > won't cleanup after it.
> > Ok for trunk?
> >

---
 gcc/collect2.c    | 6 +++---
 gcc/lto-wrapper.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/collect2.c b/gcc/collect2.c
index c54e6fb..b0784e8 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -955,9 +955,6 @@ main (int argc, char **argv)
   signal (SIGCHLD, SIG_DFL);
 #endif
 
-  if (atexit (collect_atexit) != 0)
-    fatal_error ("atexit failed");
-
   /* Unlock the stdio streams.  */
   unlock_std_streams ();
 
@@ -965,6 +962,9 @@ main (int argc, char **argv)
 
   diagnostic_initialize (global_dc, 0);
 
+  if (atexit (collect_atexit) != 0)
+    fatal_error ("atexit failed");
+
   /* Do not invoke xcalloc before this point, since locale needs to be
      set first, in case a diagnostic is issued.  */
 
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 8033b15..d97f617 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -879,13 +879,13 @@ main (int argc, char *argv[])
 
   xmalloc_set_program_name (progname);
 
-  if (atexit (lto_wrapper_cleanup) != 0)
-    fatal_error ("atexit failed");
-
   gcc_init_libintl ();
 
   diagnostic_initialize (global_dc, 0);
 
+  if (atexit (lto_wrapper_cleanup) != 0)
+    fatal_error ("atexit failed");
+
   if (signal (SIGINT, SIG_IGN) != SIG_IGN)
     signal (SIGINT, fatal_signal);
 #ifdef SIGHUP
-- 
1.8.3.1

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

* Re: [PING][PATCH] Don't call fatal_error before error reporting has been initialized.
  2014-10-20 15:27   ` Ilya Tocar
@ 2014-11-05 16:03     ` Ilya Tocar
  2014-11-17 23:04       ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Tocar @ 2014-11-05 16:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bernd Schmidt

Ping.

On 20 Oct 19:25, Ilya Tocar wrote:
> Same in collect2.
> 
> On 09 Oct 15:40, Ilya Tocar wrote:
> > Ping.
> > 
> > On 29 Sep 18:02, Ilya Tocar wrote:
> > > Hi,
> > > 
> > > Currently if call to atexit (lto_wrapper_cleanup) fails we
> > > won't report error as we haven't initialized error-reporting
> > > infrastructure. This patch moves this call after diagnostic_initialize.
> > > I hope that we can't  exit inside diagnostic_initialize. Otherwise we
> > > won't cleanup after it.
> > > Ok for trunk?
> > >
> 
> ---
>  gcc/collect2.c    | 6 +++---
>  gcc/lto-wrapper.c | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/gcc/collect2.c b/gcc/collect2.c
> index c54e6fb..b0784e8 100644
> --- a/gcc/collect2.c
> +++ b/gcc/collect2.c
> @@ -955,9 +955,6 @@ main (int argc, char **argv)
>    signal (SIGCHLD, SIG_DFL);
>  #endif
>  
> -  if (atexit (collect_atexit) != 0)
> -    fatal_error ("atexit failed");
> -
>    /* Unlock the stdio streams.  */
>    unlock_std_streams ();
>  
> @@ -965,6 +962,9 @@ main (int argc, char **argv)
>  
>    diagnostic_initialize (global_dc, 0);
>  
> +  if (atexit (collect_atexit) != 0)
> +    fatal_error ("atexit failed");
> +
>    /* Do not invoke xcalloc before this point, since locale needs to be
>       set first, in case a diagnostic is issued.  */
>  
> diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
> index 8033b15..d97f617 100644
> --- a/gcc/lto-wrapper.c
> +++ b/gcc/lto-wrapper.c
> @@ -879,13 +879,13 @@ main (int argc, char *argv[])
>  
>    xmalloc_set_program_name (progname);
>  
> -  if (atexit (lto_wrapper_cleanup) != 0)
> -    fatal_error ("atexit failed");
> -
>    gcc_init_libintl ();
>  
>    diagnostic_initialize (global_dc, 0);
>  
> +  if (atexit (lto_wrapper_cleanup) != 0)
> +    fatal_error ("atexit failed");
> +
>    if (signal (SIGINT, SIG_IGN) != SIG_IGN)
>      signal (SIGINT, fatal_signal);
>  #ifdef SIGHUP
> -- 
> 1.8.3.1
> 

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

* Re: [PING][PATCH] Don't call fatal_error before error reporting has been initialized.
  2014-11-05 16:03     ` [PING][PATCH] " Ilya Tocar
@ 2014-11-17 23:04       ` Jeff Law
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Law @ 2014-11-17 23:04 UTC (permalink / raw)
  To: Ilya Tocar, gcc-patches; +Cc: Bernd Schmidt

On 11/05/14 09:03, Ilya Tocar wrote:
> Ping.
>
> On 20 Oct 19:25, Ilya Tocar wrote:
>> Same in collect2.
>>
>> On 09 Oct 15:40, Ilya Tocar wrote:
>>> Ping.
>>>
>>> On 29 Sep 18:02, Ilya Tocar wrote:
>>>> Hi,
>>>>
>>>> Currently if call to atexit (lto_wrapper_cleanup) fails we
>>>> won't report error as we haven't initialized error-reporting
>>>> infrastructure. This patch moves this call after diagnostic_initialize.
>>>> I hope that we can't  exit inside diagnostic_initialize. Otherwise we
>>>> won't cleanup after it.
Well, diagnostic_initialize calls xmalloc, so it can certainly fail and 
when xmalloc fails, it just dumps stuff to stderr, calls anything 
registered via xatexit and exits.

So I don't see that we're going to get back into GCC's diagnostic machinery.

OK for the trunk, assuming you've bootstrapped the change.

Thanks for your patience,

Jeff


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

end of thread, other threads:[~2014-11-17 22:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29 14:03 [PATCH] Don't call fatal_error before error reporting has been initialized Ilya Tocar
2014-10-09 11:48 ` Ilya Tocar
2014-10-20 15:27   ` Ilya Tocar
2014-11-05 16:03     ` [PING][PATCH] " Ilya Tocar
2014-11-17 23:04       ` Jeff Law

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).