This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [asan] Patch - fix an ICE in asan.c


On 2012.11.12 at 19:02 +0100, Jakub Jelinek wrote:
> On Mon, Nov 12, 2012 at 06:13:08PM +0100, Markus Trippelsdorf wrote:
> > Another ICE:
> > 
> >  % cat test.ii
> >  int i;
> > 
> >  % g++ -faddress-sanitizer -c -g -O1 test.ii
> > test.ii:1:7: internal compiler error: Segmentation fault
> >   int i;
> >        ^
> 
> The RECORD_TYPE doesn't have lang specific payload allocated for it.
> There is no point why we need to describe that in the debug info though.
> 
> So I'd do something like:
> 
> 2012-11-12  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* asan.c (report_error_func): Set DECL_IGNORED_P, don't touch
> 	DECL_ASSEMBLER_NAME.
> 	(asan_init_func): Likewise.
> 	(asan_finish_file): Use void * instead of __asan_global * as
> 	type of __asan_{,un}register_globals.  Set DECL_IGNORED_P on
> 	the decls.

Thanks.
With your patch applied, it is now possible to successfully (lto-)
bootstrap gcc with CC="gcc -faddress-sanitizer" 
CXX="g++ -faddress-sanitizer".

One just has to apply the following patch from H.J. (that originally
fixed --enable-checking=valgrind):


diff --git a/libcpp/charset.c b/libcpp/charset.c
index cba19a6..6d67bca 100644
--- a/libcpp/charset.c
+++ b/libcpp/charset.c
@@ -1731,7 +1731,10 @@ _cpp_convert_input (cpp_reader *pfile, const char *input_charset,
   /* Resize buffer if we allocated substantially too much, or if we
      haven't enough space for the \n-terminator.  */
   if (to.len + 4096 < to.asize || to.len >= to.asize)
-    to.text = XRESIZEVEC (uchar, to.text, to.len + 1);
+    {
+      to.text = XRESIZEVEC (uchar, to.text, to.len + 17);
+      memset (to.text + to.len + 1, 0, 16);
+    }
 
   /* If the file is using old-school Mac line endings (\r only),
      terminate with another \r, not an \n, so that we do not mistake
-- 
Markus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]