public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Basile STARYNKEVITCH <basile@starynkevitch.net>
Cc: GCC Mailing List <gcc@gcc.gnu.org>
Subject: Re: MELT tutorial on the wiki
Date: Thu, 30 Jul 2009 21:17:00 -0000	[thread overview]
Message-ID: <m3k51prhv4.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4A707003.8060103@starynkevitch.net> (Basile STARYNKEVITCH's message of "Wed\, 29 Jul 2009 17\:51\:31 +0200")

>>>>> "Basile" == Basile STARYNKEVITCH <basile@starynkevitch.net> writes:

Hi Basile.

Basile> I added as a turorial on the wiki, a small MELT pass which warns
Basile> against fprintf(stdout, ...) in the compiled code.

Basile> For GCC hackers, is the page
Basile> http://gcc.gnu.org/wiki/writing%20a%20pass%20in%20MELT
Basile> clear enough?

I've been looking for a very simple way to do some kinds of static
analysis on gdb, so today I tried building the MELT branch in hopes it
would serve this need.  Unfortunately, it didn't compile.

With C++ enabled, I got this failure:

/space/tromey/MELT/gcc/libstdc++-v3/include/precompiled/stdc++.h:98:18: fatal error: chrono: No such file or directory


With just C enabled, I got:

make[2]: *** No rule to make target `install-melt-headers', needed by `install'.  Stop.
make[2]: Leaving directory `/space/tromey/MELT/build/gcc'


In both cases I just configured with --disable-bootstrap --enable-melt,
plus the appropriate --enable-langauges option.  This is on x86 F11.

Basile> (of course, the pass implementation is imperfect, but I have hard time
Basile> finding good *small* examples).

My gdb examples involve finding broken code that can't be diagnosed by
the compiler.  Most of my examples are simple, but also actually useful.

For example, gdb has function that in the past could return null, but
which now cannot.  So, I'd like to find all places where the return
result is checked.

Or, gdb has a TRY_CATCH macro which expands to a couple of nested loops.
It is not ok to 'return' or 'goto' from inside the inner loop, as this
causes hard-to-find bugs.  So, it would be nice to find any place that
tries this.

Or, there is a data type in gdb that used to be freed using 'xfree', but
which now requires a special function to be called instead.  So, it
would be nice to find any place where xfree is passed an argument of
this type.

Etc.  For my purposes, any kind of simple analysis pass that is simple
to hack and doesn't require me to learn too much would be ideal.

Tom

  reply	other threads:[~2009-07-30 21:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 15:52 Basile STARYNKEVITCH
2009-07-30 21:17 ` Tom Tromey [this message]
2009-07-31  6:27   ` Basile STARYNKEVITCH
2009-07-31 17:52     ` Tom Tromey
2009-07-31 20:16       ` Tom Tromey
2009-08-01  6:11         ` Basile STARYNKEVITCH
2009-08-01  7:06           ` Ralf Wildenhues
2009-08-02 14:57           ` Paolo Bonzini
2009-08-03 16:23           ` Tom Tromey
2009-08-03 19:21             ` Basile STARYNKEVITCH
2009-08-01  6:28       ` Dave Korn
2009-08-01  6:43         ` Basile STARYNKEVITCH
2009-08-01  6:58           ` Dave Korn
2009-08-03 16:12             ` Tom Tromey
2009-08-04 13:22               ` Dave Korn
2009-08-23 20:14         ` Ralf Wildenhues
2009-08-01  8:44   ` Paolo Bonzini
2009-08-01  8:57     ` Basile STARYNKEVITCH
2009-08-03 16:16     ` Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2009-05-10 12:02 Basile STARYNKEVITCH

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=m3k51prhv4.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=basile@starynkevitch.net \
    --cc=gcc@gcc.gnu.org \
    /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).