[Bug rtl-optimization/67037] [4.9 Regression] Wrong code at -O1 and above on ARM

2016-06-29 Thread notasas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67037

--- Comment #11 from notasas at gmail dot com ---
FWIW I've tried sending a backport patch, but it was ignored:
https://gcc.gnu.org/ml/gcc-patches/2015-10/msg03116.html

[Bug rtl-optimization/67037] [4.9/5 Regression] Wrong code at -O1 and above on ARM

2015-10-19 Thread notasas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67037

--- Comment #7 from notasas at gmail dot com ---
Anyone's up for the backports? The patch applies cleanly on both gcc-4_9 and
gcc-5 branches.
I've tested patched 4.9.3 and wine no longer crashes when built with it.


[Bug rtl-optimization/67028] combine bug. Different assumptions about subreg in different places.

2015-07-28 Thread notasas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67028

notasas at gmail dot com changed:

   What|Removed |Added

 CC||notasas at gmail dot com

--- Comment #5 from notasas at gmail dot com ---
gcc 4.7.2, 4.8.2, 4.9.3 are also affected.


[Bug rtl-optimization/67037] New: [4.9 Regression] Wrong code at -O1 and above on ARM

2015-07-27 Thread notasas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67037

Bug ID: 67037
   Summary: [4.9 Regression] Wrong code at -O1 and above on ARM
   Product: gcc
   Version: 4.9.3
Status: UNCONFIRMED
  Keywords: wrong-code
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: notasas at gmail dot com
  Target Milestone: ---
Target: arm-unknown-linux-gnueabi, arm-linux-gnueabihf

Created attachment 36076
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36076&action=edit
testcase

The reduced testcase (based on "real" code from wine sources) crashes:

notaz@evm:/tmp/t$ cc -Wall -O0 testcase.c && ./a.out
notaz@evm:/tmp/t$ cc -Wall -O1 testcase.c && ./a.out
Segmentation fault
notaz@evm:/tmp/t$ cc -Wall -O2 testcase.c && ./a.out
Segmentation fault
notaz@evm:/tmp/t$ cc -Wall -Os testcase.c && ./a.out
notaz@evm:/tmp/t$ cc -Wall -O1 testcase.c -mcpu=arm920t -marm && ./a.out
Segmentation fault
notaz@evm:/tmp/t$ cc -Wall -O1 testcase.c -mcpu=cortex-a15 && ./a.out
Segmentation fault

gcc 4.7.2 and 4.8.2 seem to be ok.

It looks like this chunk

while ((count > 1) && *s)
{
count--;
*d++ = *s++;
}

is compiled to

add r3, sp, #5312
add r3, r3, #52
ldr r3, [r3]@ count
cmp r3, #1
bls .L6
movwr2, #:lower16:.LANCHOR0
mov r3, #78
movtr2, #:upper16:.LANCHOR0
b   .L8
.L18:
ldrhr3, [r2, #2]!
cmp r3, #0
beq .L9
.L8:
add r1, sp, #5312
add r1, r1, #52
ldr r0, [r1]
sub r0, r0, #1
str r0, [r1]
ldr r1, [r3]@ <-- crash
cmp r0, #1
strhr3, [r1], #2@ movhi
add r3, sp, #5312
add r3, r3, #48
str r1, [r3]
bne .L18
.L9:

so it thinks r3 contains pointer to count, even though it loaded *s there?
The conditions for this bug seem to be large stack frame that load/store
offsets can't reach and enough register pressure.