[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2021-02-02 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

--- Comment #9 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:eedda4e160856b7ac0c533ac9445161d0fd88660

commit r11-7033-geedda4e160856b7ac0c533ac9445161d0fd88660
Author: Jakub Jelinek 
Date:   Tue Feb 2 10:01:40 2021 +0100

testsuite: Add testcase for already fixed PR [PR97960]

This testcase has been fixed by
r11-5904-g4cf70c20cb10acd6fb1016611d05540728176b60
so I'm checking it in so that we can close the PR.

2021-02-02  Jakub Jelinek  

PR tree-optimization/97960
* g++.dg/torture/pr97960.C: New test.

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2021-02-01 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

--- Comment #8 from Jakub Jelinek  ---
Indeed, r11-5904-g4cf70c20cb10acd6fb1016611d05540728176b60 fixed it.  I'll add
the testcase into the testsuite after testing it.

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2021-01-22 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

--- Comment #7 from Alex Coplan  ---
FWIW, the testcase now exits cleanly on AArch64 with current trunk.

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2021-01-22 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

--- Comment #6 from Richard Biener  ---
Is it maybe fixed with the latest re-org of split_constant_offset?

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2021-01-21 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek  ---
Richard, did you have time to look into this yet?

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2020-11-24 Thread rsandifo at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rsandifo at gcc dot 
gnu.org

--- Comment #4 from rsandifo at gcc dot gnu.org  
---
Mine.  Might not be able to get to it for a few days though.

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2020-11-24 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

--- Comment #3 from Richard Biener  ---
Creating dr for b[_7]
base_address: &b
offset from base address: (ssizetype) ((sizetype) (signed char) _5 * 4)
constant offset from base address: -1012
step: 4
base alignment: 32
base misalignment: 0
offset alignment: 4
step alignment: 4
base_object: b
Access function 0: {(int) h_20, +, 1}_2

looks like the wrong sign for the constant offset.

#0  split_constant_offset_1 (type=, 
op0=, code=NOP_EXPR, op1=, 
var=0x7fffba10, off=0x7fffba08, cache=..., limit=0x7fffc19c)

now, var_min/max is UNSIGNED -3 / -1 (precision 8), woff is 3
we compute -3 + 3 == 0 and overflow to true (UNSIGNED arithmetic)

_5 = (unsigned char) _35;
_6 = _5 + 3;
h_20 = (signed char) _6;

but then we continue with

/* Calculate (ssizetype) OP0 - (ssizetype) TMP_VAR.  */
widest_int diff = (widest_int::from (op0_min, sgn)
   - widest_int::from (var_min, sgn));

getting -253.  I remember this place has changed quite some times and
wide (sign-extended) vs. widest (signed) ints do not make it easier
to see what's correct ...

I'm defering to Richard here.  The C testcase trips at this point just
twice (ldist and vectorizer) so it's easy enough to 'catch' in a debugger.

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2020-11-24 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

Richard Biener  changed:

   What|Removed |Added

   Priority|P1  |P2
 CC||rguenth at gcc dot gnu.org

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2020-11-23 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

Martin Liška  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 CC||marxin at gcc dot gnu.org,
   ||rsandifo at gcc dot gnu.org
   Last reconfirmed||2020-11-23
   Priority|P3  |P1
 Ever confirmed|0   |1
   Target Milestone|--- |8.5
   Keywords||wrong-code

--- Comment #2 from Martin Liška  ---
Confirmed!

[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d

2020-11-23 Thread acoplan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960

--- Comment #1 from Alex Coplan  ---
C testcase:

const int *c(const int *p, const int *q)
{
  if (*p < *q)
return q;
  return p;
}

short a[575];
unsigned b[25];
unsigned char g;
int main()
{
  for (int e = 0; e < 23; ++e)
a[e * 23] = 16137;

  int t1 = g;
  int t2 = 253;
  signed char h = *c(&t1, &t2) + 3;

  for (; h < 24; h++)
b[h] = 1064739102;

  for (int e = 0; e < 23; ++e)
if (a[e * 23] != 16137)
  __builtin_abort();
}