public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH] Fix PR target/48807
@ 2011-05-19 13:08 Henderson, Stuart
  2011-05-26 11:02 ` Henderson, Stuart
  2011-05-26 13:46 ` Bernd Schmidt
  0 siblings, 2 replies; 4+ messages in thread
From: Henderson, Stuart @ 2011-05-19 13:08 UTC (permalink / raw)
  To: gcc-patches

Ping
http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00503.html


Hi,
The attached patch is a fix for PR/48807, which is a segfault when compiling the bfin compiler.  The problem appears to be that we're not checking the return value of cgraph_local_info for null before attempting to dereference it.  This wasn't a problem before, but now cgraph_local_info calls cgraph_get_node (instead of the old cgraph_node), we cannot assume it will always return non-null.

Fix is in bfin specific code.

Ok to commit to trunk?

Stu


2011-05-06  Stuart Henderson  <shenders@gcc.gnu.org>

    * config/bfin/bfin.c: Check return value of cgraph_local_info for null before
        attempting to use it.




Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c      (revision 173363)
+++ gcc/config/bfin/bfin.c      (working copy)
@@ -2077,6 +2077,8 @@

   this_func = cgraph_local_info (current_function_decl);
   called_func = cgraph_local_info (decl);
+  if (!called_func || !this_func)
+    return false;
   return !called_func->local || this_func->local;
 }


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

* RE: [PATCH] Fix PR target/48807
  2011-05-19 13:08 [PATCH] Fix PR target/48807 Henderson, Stuart
@ 2011-05-26 11:02 ` Henderson, Stuart
  2011-05-26 13:46 ` Bernd Schmidt
  1 sibling, 0 replies; 4+ messages in thread
From: Henderson, Stuart @ 2011-05-26 11:02 UTC (permalink / raw)
  To: gcc-patches

Ping Ping.

-----Original Message-----
From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-owner@gcc.gnu.org] On Behalf Of Henderson, Stuart
Sent: 19 May 2011 13:39
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix PR target/48807

Ping
http://gcc.gnu.org/ml/gcc-patches/2011-05/msg00503.html


Hi,
The attached patch is a fix for PR/48807, which is a segfault when compiling the bfin compiler.  The problem appears to be that we're not checking the return value of cgraph_local_info for null before attempting to dereference it.  This wasn't a problem before, but now cgraph_local_info calls cgraph_get_node (instead of the old cgraph_node), we cannot assume it will always return non-null.

Fix is in bfin specific code.

Ok to commit to trunk?

Stu


2011-05-06  Stuart Henderson  <shenders@gcc.gnu.org>

    * config/bfin/bfin.c: Check return value of cgraph_local_info for null before
        attempting to use it.




Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c      (revision 173363)
+++ gcc/config/bfin/bfin.c      (working copy)
@@ -2077,6 +2077,8 @@

   this_func = cgraph_local_info (current_function_decl);
   called_func = cgraph_local_info (decl);
+  if (!called_func || !this_func)
+    return false;
   return !called_func->local || this_func->local;
 }




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

* Re: [PATCH] Fix PR target/48807
  2011-05-19 13:08 [PATCH] Fix PR target/48807 Henderson, Stuart
  2011-05-26 11:02 ` Henderson, Stuart
@ 2011-05-26 13:46 ` Bernd Schmidt
  1 sibling, 0 replies; 4+ messages in thread
From: Bernd Schmidt @ 2011-05-26 13:46 UTC (permalink / raw)
  To: Henderson, Stuart; +Cc: gcc-patches

On 05/19/2011 12:39 PM, Henderson, Stuart wrote:
>     * config/bfin/bfin.c: Check return value of cgraph_local_info for null before
>         attempting to use it.

Needs to mention the function name, and wrap the long line properly.

> Index: gcc/config/bfin/bfin.c
> ===================================================================
> --- gcc/config/bfin/bfin.c      (revision 173363)
> +++ gcc/config/bfin/bfin.c      (working copy)
> @@ -2077,6 +2077,8 @@

Using the "-p" option for diff is preferrable. See
  http://gcc.gnu.org/wiki/SvnTricks

>    this_func = cgraph_local_info (current_function_decl);
>    called_func = cgraph_local_info (decl);
> +  if (!called_func || !this_func)
> +    return false;
>    return !called_func->local || this_func->local;
>  }

Ok, although I think this_func should never be NULL?


Bernd

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

* [PATCH] Fix PR target/48807
@ 2011-05-06 10:57 Henderson, Stuart
  0 siblings, 0 replies; 4+ messages in thread
From: Henderson, Stuart @ 2011-05-06 10:57 UTC (permalink / raw)
  To: gcc-patches

Hi,
The attached patch is a fix for PR/48807, which is a segfault when compiling the bfin compiler.  The problem appears to be that we're not checking the return value of cgraph_local_info for null before attempting to dereference it.  This wasn't a problem before, but now cgraph_local_info calls cgraph_get_node (instead of the old cgraph_node), we cannot assume it will always return non-null.

Fix is in bfin specific code.

Ok to commit to trunk?

Stu


2011-05-06  Stuart Henderson  <shenders@gcc.gnu.org>

    * config/bfin/bfin.c: Check return value of cgraph_local_info for null before
        attempting to use it.




Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c      (revision 173363)
+++ gcc/config/bfin/bfin.c      (working copy)
@@ -2077,6 +2077,8 @@

   this_func = cgraph_local_info (current_function_decl);
   called_func = cgraph_local_info (decl);
+  if (!called_func || !this_func)
+    return false;
   return !called_func->local || this_func->local;
 }





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

end of thread, other threads:[~2011-05-26 13:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 13:08 [PATCH] Fix PR target/48807 Henderson, Stuart
2011-05-26 11:02 ` Henderson, Stuart
2011-05-26 13:46 ` Bernd Schmidt
  -- strict thread matches above, loose matches on Subject: below --
2011-05-06 10:57 Henderson, Stuart

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