Do we know anything about "Csmith"?
Maybe we should try it?
Andrew
-------- Original Message -------- Subject: Re: [PATCH][ARM] pr50193: ICE on a | (b << negative-constant) Date: Thu, 1 Sep 2011 13:21:38 +0000 (UTC) From: Joseph S. Myers joseph@codesourcery.com To: Andrew Stubbs ams@codesourcery.com CC: gcc-patches@gcc.gnu.org, patches@linaro.org Newsgroups: gmane.comp.gcc.patches References: 4E5F6B5F.2020207@codesourcery.com
On Thu, 1 Sep 2011, Andrew Stubbs wrote:
This patch fixes the problem by merely checking that the constant is positive. I've confirmed that values larger than the mode-size are not a problem because the compiler optimizes those away earlier, even at -O0.
Do you mean that you have observed for some testcases that they get optimized away - or do you have reasons (if so, please state them) to believe that any possible path through the compiler that would result in a larger constant here (possibly as a result of constant propagation and other optimizations) will always result in it being optimized away as well? If it's just observation it would be better to put the complete check in here.
Quite of few of the Csmith-generated bug reports from John Regehr have involved constants appearing in unexpected places as a result of transformations in the compiler. It would probably be a good idea for someone to try using Csmith to find ARM compiler bugs (both ICEs and wrong-code); pretty much all the bugs reported have been testing on x86 and x86_64, so it's likely there are quite a few bugs in the ARM back end that could be found that way.
On Fri, Sep 2, 2011 at 1:46 AM, Andrew Stubbs andrew.stubbs@gmail.com wrote:
Do we know anything about "Csmith"?
Maybe we should try it?
I couldn't resist having a go. It's Friday afternoon after all.
I put on my end user hat, built csmith 2.0, fixed the x86 assembly code, and started it running against gcc-linaro-4.6-2011.08 at -O2 and -O3. 772 tests so far and no faults. I'll leave it running over the weekend.
I quite like the big red warnings on the 'using' page[1].
-- Michael [1] http://embed.cs.utah.edu/csmith/using.html
On Fri, Sep 2, 2011 at 3:21 PM, Michael Hope michael.hope@linaro.org wrote:
On Fri, Sep 2, 2011 at 1:46 AM, Andrew Stubbs andrew.stubbs@gmail.com wrote:
Do we know anything about "Csmith"?
Maybe we should try it?
I couldn't resist having a go. It's Friday afternoon after all.
I put on my end user hat, built csmith 2.0, fixed the x86 assembly code, and started it running against gcc-linaro-4.6-2011.08 at -O2 and -O3. 772 tests so far and no faults. I'll leave it running over the weekend.
I quite like the big red warnings on the 'using' page[1].
A weekend and 42,237 tests later, the compiler crashed six times. The files and compiler output are at: http://people.linaro.org/~michaelh/incoming/csmith/
There are four variants of a (set (reg:SI) (minus:SI (const_int) (const_int))) which might be a real fault.
There is one (set (reg:SI (neg:SI (const_int)))) and one ICE in find_valid_class().
I haven't looked into the code to see if the tests are valid. The Natty GCC on x86_64 compiles all of them just fine.
The ICEs are:
crash4.c:1103:1: error: insn does not satisfy its constraints: (insn 750 346 376 28 (set (reg:SI 12 ip [orig:492 si1 ] [492]) (minus:SI (const_int 12 [0xc]) (const_int -511334738 [0xffffffffe185a6ae]))) crash4.c:1037 29 {*arm_subsi3_insn} (nil)) crash4.c:1103:1: internal compiler error: in copyprop_hardreg_forward_1, at regcprop.c:766
crash5.c:792:1: error: insn does not satisfy its constraints: (insn 726 230 742 16 (set (reg:SI 7 r7 [319]) (minus:SI (const_int 7 [0x7]) (const_int 65535 [0xffff]))) ../runtime/safe_math.h:658 29 {*arm_subsi3_insn} (nil)) crash5.c:792:1: internal compiler error: in copyprop_hardreg_forward_1, at regcprop.c:766
crash6.c:216:1: error: insn does not satisfy its constraints: (insn 528 443 209 15 (set (reg:SI 1 r1 [374]) (minus:SI (const_int 3 [0x3]) (const_int 1038957434 [0x3ded3b7a]))) ../runtime/safe_math.h:175 29 {*arm_subsi3_insn} (nil)) crash6.c:216:1: internal compiler error: in copyprop_hardreg_forward_1, at regcprop.c:766
crash1.c:734:1: error: insn does not satisfy its constraints: (insn 348 127 129 8 (set (reg:SI 2 r2 [271]) (minus:SI (const_int 10 [0xa]) (const_int -336820015 [0xffffffffebec88d1]))) ../runtime/safe_math.h:440 29 {*arm_subsi3_insn} (nil))
crash2.c:764:1: error: unrecognizable insn: (insn 1206 364 368 27 (set (reg:SI 3 r3 [534]) (neg:SI (const_int -1871828801 [0xffffffff906e28bf]))) ../runtime/safe_math.h:440 -1 (nil))
crash3.c: In function 'func_93': crash3.c:1069:1: internal compiler error: in find_valid_class, at reload.c:710
-- Michael
linaro-toolchain@lists.linaro.org