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]

Re: C++ PATCH: Avoid wild reads


Mark Mitchell wrote:
> 
> Jeffrey Oldham figured out that we were touching uninitialized memory
> in instantiate_template:
> 
>   for (clone = TREE_CHAIN (gen_tmpl);
>        clone && DECL_CLONED_FUNCTION_P (clone);
>        clone = TREE_CHAIN (clone))
> 
> Here, the clone can be something like a VAR_DECL that doesn't have a
> full lang_decl, and therefore DECL_CLONED_FUNCTION_P doesn't make
> sense.
This fixes bug 1551, which I was just about to bash on.

I've installed the attached testcase from bug 1551.

nathan

-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
// Build don't link:

// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Jan 2001 <nathan@codesourcery.com>

// Bug 1551. We were accessing some uninitialized memory, causing us
// to reject this.

template <typename T>
struct base
{
base();
base(unsigned);
};

template <typename V>
struct Y
{
Y(unsigned = 0);
};

template <>
Y<char>::Y(unsigned) { }

base<double> x;

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