Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Siddhesh Poyarekar <siddhesh@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: bitpos expansion patches summary
Date: Tue, 11 Sep 2012 19:04:00 -0000	[thread overview]
Message-ID: <20120911190421.GA26399@host2.jankratochvil.net> (raw)
In-Reply-To: <20120907162158.0aee8e85@spoyarek>

[-- Attachment #1: Type: text/plain, Size: 4072 bytes --]

On Fri, 07 Sep 2012 12:51:58 +0200, Siddhesh Poyarekar wrote:
> On Sun, 2 Sep 2012 20:15:15 +0200, Jan wrote:
> > I was thinking about some updating of file:lineno records in
> > '.locdiff.report' file to their new location and then diffing the
> > old+reviewed '.locdiff.report' against new file.  But I have not
> > tried it yet in practice.
> 
> This will be heuristic to some extent, which is why I avoided it. 

The current locdiff output is already heuristic.  With the attached source:

perl -pe 's/\Q{+\E(.*)?\Q+}\E/$1/g;s/\Q[-\E(.*)?\Q-]\E//g' <5.s >5p.c;perl -pe 's/\Q{+\E(.*)?\Q+}\E//g;s/\Q[-\E(.*)?\Q-]\E/$1/g' <5.s >5m.c;diff -u 5m.c 5p.c;for i in 5m 5p;do gcc -o $i $i.c -Wall -g;splint -showcolumn $i.c|sed "s/$i[.]c/5.c/"|perl -lpe 's/^(\s*)(\S*?\.[ch]:\d+):/$1LOC $2\n/'|tee $i.splint|perl -lpe 's{^(\s*)LOC (.*)$}{$1LOC}' >$i.splintloc;done;diff -U-1 5{m,p}.splintloc;perl -le 'print "-"x80';/tmp/splint-bitpos/splint-locdiff 5{m,p}.splint

as explanation of the script above the source line
  [-int-]{+long+} len;
gets translated in the two sources accordingly:
  int len;
->
  long len;

--- 5m.splintloc	2012-09-11 20:46:27.727578194 +0200
+++ 5p.splintloc	2012-09-11 20:46:27.785578114 +0200
@@ -1,11 +1,11 @@
 5.c: (in function stub1)
 LOC
  Variable stubj initialized to type long int, expects int: stubi
   To ignore type qualifiers in type comparisons use +ignorequals.
-5.c: (in function f)
+5.c: (in function g)
 LOC
  Assignment of long int to int: b.len = a.len
 5.c: (in function stub2)
 LOC
  Variable stubj initialized to type long int, expects int: stubi
 
--------------------------------------------------------------------------------
LOC 5.c:6
 Variable stubj initialized to type long int, expects int: stubi
  To ignore type qualifiers in type comparisons use +ignorequals.
LOC 5.c:49
 Variable stubj initialized to type long int, expects int: stubi


The first part shows there is only very minor difference of the splint output
while the splint-locdiff already contains no traces of it.

And still the change caused a type safety regression in function g.

I hope such cases do not happen in real but it is still a heuristic hope only.


How do you want to check it in without doing several rebases?

Also I have found several missed expansions only by hand, one needs to do full
re-run of splint on the patched sources.  As the patched sources change line
numbers a bit it already means some sort of rebase.

Also we have now about a month old analysis, all the code checked in the last
month may be broken.

Additionally I am pretty sure the codebase will get broken soon again as it is
common GDB practice to use 'int' for every length and I do not review very
every check-in.  So it would be nice to possibly be able to do such
incremental re-checks in the future; although I am not sure it will be done.


Also IMO (any feedback from other maintainers?) we need full annotation of the
patch file as with such large number of change there is not clear which
changes are justified and whether there are no excessive changes.
	http://people.redhat.com/jkratoch/bitpos3.patch
	(lines starting with 'x')


> Probably a case of different line numbers due to using a different
> updated version? I was rebasing every now and then, which gave me
> different line numbers for some warnings. I see this on line 4695 now.

I stay with 2636a39d8bf9b24dce328e4f906e8710b52d2105 which is a commit very
close to the time you generated the output.

We should always stick to a single commit and document which commit, otherwise
it is difficult to interchange the data.


I will reply to the specific items in next mail.  Then we need some new full
run of splint on patched sources and reuse the existing reviews in some
hauristic way.

And to complete the patch annotation.  I wrote it in a way to make it
automatically cross-checkable.  That each 'x' line in the patch has
corresponding 'report' line and that each FIXED 'report' line has at least one
'x' line in the patch.  I still have no script for checking the 'x' lines.


Thanks,
Jan

[-- Attachment #2: 5.s --]
[-- Type: text/plain, Size: 531 bytes --]

static long used;

static void
stub1 (long stubi)
{
  int stubj = stubi;

  used = stubj;
}

struct s1
{
  long len;
};

struct s2
{
  [-int-]{+long+} len;
};

struct s3
{
  int len;
};

static void
f (void)
{
  struct s1 a = { 0 };
  struct s2 b;

  b.len = a.len;
  used = b.len;
}

static void
g (void)
{
  struct s2 a = { 0 };
  struct s3 b;

  b.len = a.len;
  used = b.len;
}

static void
stub2 (long stubi)
{
  int stubj = stubi;

  used = stubj;
}

int main (void)
{
  stub1 (0);
  stub2 (0);
  f ();
  g ();
  return 0;
}

  reply	other threads:[~2012-09-11 19:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-04 19:24 Siddhesh Poyarekar
2012-08-07 14:39 ` Jan Kratochvil
2012-08-07 15:10   ` Siddhesh Poyarekar
2012-08-07 15:48   ` Siddhesh Poyarekar
2012-08-08 22:43 ` Jan Kratochvil
2012-08-08 22:50   ` Jan Kratochvil
2012-08-09  2:04   ` Siddhesh Poyarekar
2012-08-10  1:28   ` Siddhesh Poyarekar
2012-08-17  9:35     ` Siddhesh Poyarekar
2012-08-09 20:04 ` Jan Kratochvil
2012-08-10  1:44   ` Siddhesh Poyarekar
2012-08-10  7:51     ` Jan Kratochvil
2012-08-10  7:58       ` Siddhesh Poyarekar
2012-08-12 17:57 ` Jan Kratochvil
2012-08-13  2:52   ` Siddhesh Poyarekar
2012-08-13 13:49     ` Jan Kratochvil
2012-08-13 14:04       ` Siddhesh Poyarekar
2012-08-13 14:12         ` Jan Kratochvil
2012-08-13 14:24           ` Siddhesh Poyarekar
2012-08-17  9:35           ` [PATCH 4/3] bitpos: Expand parameters of watchpoint functions Siddhesh Poyarekar
2012-08-19 16:42 ` bitpos expansion patches summary Jan Kratochvil
2012-08-21  6:51   ` Siddhesh Poyarekar
2012-08-26 18:21 ` Jan Kratochvil
2012-08-27  8:10   ` Siddhesh Poyarekar
2012-08-27 14:02     ` Jan Kratochvil
2012-09-02 18:15 ` Jan Kratochvil
2012-09-07 10:52   ` Siddhesh Poyarekar
2012-09-11 19:04     ` Jan Kratochvil [this message]
2012-09-11 19:26       ` Tom Tromey
2012-09-11 19:37         ` Jan Kratochvil
2012-09-13 18:45       ` Jan Kratochvil
2012-09-13 16:48     ` Jan Kratochvil
2012-09-14  6:20       ` Siddhesh Poyarekar
2012-09-04 15:03 ` Jan Kratochvil
2012-09-04 15:09   ` Siddhesh Poyarekar
2012-09-07 11:10   ` Siddhesh Poyarekar

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=20120911190421.GA26399@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=siddhesh@redhat.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