Re: sparse-next and preview of 0.5.1-rc5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 20, 2017 at 11:40 PM, Christopher Li <sparse@xxxxxxxxxxx> wrote:
> int *ptr;
> int foo( int i)
> {
> int *p;
> switch (i - i) {        // will be optimized to 0
> case 0:                 // will be the simple branch
> return 0;
> case 1:                 // will be optimized away
> do {            // will be an unreachable loop
>    *p++ = 123;
> } while (--i);
> }
> return 1;
> }
>
> Which will show "crazy programmer" in sparse-next but not your patch.

I dig out more, before it is showing the crazy programmer. This is the
IR it is working on:

Notice the "add.64      %r6 <- %r6, $4", that is very wrong.
Not valid SSA form at all.

I believe that is the one of the condition triggering the crazy programmer
bug.

This error actually reminds me the wine dead loop bug.
In the wine dead loop IR we have:

 setne.32    %r11 <- %r11, $0

This two bugs might actually be related.

We shouldn't have
"add.64      %r6 <- %r6, $4"
That already screw up very badly.
I confirm that "add.64      %r6 <- %r6, $4" was in your purpose
patch as well. It is just you pack the BB early so it does not
trigger the "crazy programmer".

I think your patch pack the BB early to avoid the "crazy programmer".
That sounds more like a cover up rather than a proper fix up.

If we have the proper SSA form, the "crazy programmer" shouldn't
pop up at all.

BTW, that is exactly why I want to get a test C test file to expose
the bug. From the description of the bug does not show as much
detail as the test C code. Different people will have different
views of how the bug happen and how to fix it. Given enough eye
ball, all the bug will be obvious.

Chris


<entry-point>
phisrc.32   %phi3(i) <- %arg1
br          .L2

.L2:
phisrc.32   %phi1(return) <- $0
br          .L4

.L3:
br          .L5

.L5:
add.64      %r6 <- %r6, $4 <============ this is very wrong
store.32    $123 -> 0[%r6] <========== cause crazy programmer here.
br          .L6

.L6:
phi.32      %r7 <- %phi3(i), %phi4(i)
sub.32      %r8 <- %r7, $1
phisrc.32   %phi4(i) <- %r8
cbr         %r8, .L5, .L7

.L7:
br          .L1

.L1:
phisrc.32   %phi2(return) <- $1
br          .L4

.L4:
phi.32      %r4 <- %phi1(return), %phi2(return)
ret.32      %r4
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux