From: Daniel Berlin <dan@cgsoftware.com>
To: Zack Weinberg <zack@codesourcery.com>
Cc: Diego Novillo <dnovillo@redhat.com>, gcc@gcc.gnu.org
Subject: Re: better -Wuninitialized (Re: Ada files now checked in)
Date: Sun, 07 Oct 2001 11:29:00 -0000 [thread overview]
Message-ID: <2226051E-BB51-11D5-9E2C-0030657B5340@cgsoftware.com> (raw)
In-Reply-To: <20011007105319.M9432@codesourcery.com>
On Sunday, October 7, 2001, at 01:53 PM, Zack Weinberg wrote:
> On Sun, Oct 07, 2001 at 01:21:01PM -0400, Diego Novillo wrote:
>> On Sun, 07 Oct 2001, Zack Weinberg wrote:
>>> Maybe you could change the warning message to "...used uninitialized
>>> here" or "at this point" or something like that? Just to be clear
>>> it's not the same old "somewhere in the function" message.
>>>
>> Sure.
>
> Thanks.
>
>>> I notice it says "_is_ used uninitialized". Does that mean you've
>>> eliminated the old false positive problems?
>>>
>> That's the intent. The new code still spews out false positives,
>> that's what I'm now working on.
>>
>> The analysis depends on the computation of reaching definitions.
>> Prior to computing the SSA form, we insert ghost definitions for
>> every symbol in the entry basic block. After reaching
>> definitions, we traverse all the variable use references in the
>> function. For every use:
>>
>> - if its only reaching definition is the ghost def, the variable
>> *is* used uninitialized.
>>
>> - if one of its reaching definitions is the ghost def, the
>> variable *may be* used uninitialized.
> ...
>
> I'm not too familiar with reaching definitions, do they take control
> dependencies into account?
>
> It would often be helpful if an uninitialized variable could be
> automatically set to a "poison" value by the compiler. This would
> prevent one major cause of hard-to-find context-dependent bugs. It
> sounds like this can easily be implemented by emitting real code for
> the ghost definitions; dead code elimination would then zap it in all
> cases where there isn't a problem. Have you considered this?
>
>> Also, I'm about to add def-def chains to model non-killing
>> definitions like:
>>
>> 1: int a, b *p;
>> 2:
>> 3: a = 4;
>> 4: *p = 3;
>> 5: b = a + 1;
>>
>> The use of a at line 5 may be reached by the definitions of *p
>> and a at lines 4 and 3, respectively. But this part is nowhere
>> near ready.
>
> Hmmm... since p itself is not initialized, it seems like you'd want to
> complain about it and then assume it doesn't alias anything.
>
>> - Compute the SSA form. This involves computing immediate
>> dominators and dominance frontiers. I believe the algorithms
>> we have in GCC are quite quick, but I haven't really looked.
>
> If I remember correctly we are using the state-of-the-art algorithm,
Not anymore, at least for phi placement.
Dominance calculation is as fast as it's gonna get without using *much*
more complex datastructures (microtrees and whatnot).
> but its use of sbitmaps may cause problems. (looking at ssa.c - dunno
> if the same code is used for trees).
>
next prev parent reply other threads:[~2001-10-07 11:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-06 18:25 Ada files now checked in dewar
2001-10-07 0:38 ` Diego Novillo
2001-10-07 0:59 ` Zack Weinberg
2001-10-07 10:24 ` Diego Novillo
2001-10-07 10:53 ` better -Wuninitialized (Re: Ada files now checked in) Zack Weinberg
2001-10-07 10:57 ` Joseph S. Myers
2001-10-07 11:23 ` Diego Novillo
2001-10-07 11:21 ` Diego Novillo
2001-10-07 11:55 ` Zack Weinberg
2001-10-07 12:06 ` Daniel Berlin
2001-10-07 16:01 ` Diego Novillo
2001-10-07 11:29 ` Daniel Berlin [this message]
2001-10-07 11:05 ` Ada files now checked in Daniel Berlin
2001-10-07 11:29 ` Diego Novillo
2001-10-07 11:37 ` Daniel Berlin
2001-10-14 7:53 ` Joern Rennecke
2001-10-07 15:19 better -Wuninitialized (Re: Ada files now checked in) dewar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2226051E-BB51-11D5-9E2C-0030657B5340@cgsoftware.com \
--to=dan@cgsoftware.com \
--cc=dnovillo@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=zack@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).