[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-08-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

--- Comment #12 from Richard Biener  ---
Author: rguenth
Date: Mon Aug 28 12:49:55 2017
New Revision: 251381

URL: https://gcc.gnu.org/viewcvs?rev=251381=gcc=rev
Log:
2017-08-28  Richard Biener  

Backport from mainline
2017-06-14  Richard Biener  

PR middle-end/81088
* fold-const.c (split_tree): Drop TREE_OVERFLOW flag from
literal constants.
(fold_binary_loc): When associating do not treat pre-existing
TREE_OVERFLOW on literal constants as a reason to allow
TREE_OVERFLOW on associated literal constants.

* c-c++-common/ubsan/pr81088.c: New testcase.

2017-06-13  Richard Biener  

PR middle-end/81065
* fold-const.c (extract_muldiv_1): Remove bogus distribution
case of C * (x * C2 + C3).
(fold_addr_of_array_ref_difference): Properly fold index difference.

* c-c++-common/ubsan/pr81065.c: New testcase.

2017-06-08  Marek Polacek  

PR sanitize/80932
* c-c++-common/ubsan/pr80932.c: Test with ints, not with long ints.

2017-06-07  Marek Polacek  

PR sanitizer/80932
* fold-const.c (extract_muldiv_1) : Add
TYPE_OVERFLOW_WRAPS check. 

* c-c++-common/ubsan/pr80932.c: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/c-c++-common/ubsan/pr80932.c
branches/gcc-7-branch/gcc/testsuite/c-c++-common/ubsan/pr81065.c
branches/gcc-7-branch/gcc/testsuite/c-c++-common/ubsan/pr81088.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/fold-const.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

--- Comment #11 from Marek Polacek  ---
Author: mpolacek
Date: Thu Jun  8 12:38:27 2017
New Revision: 249010

URL: https://gcc.gnu.org/viewcvs?rev=249010=gcc=rev
Log:
PR sanitize/80932
* c-c++-common/ubsan/pr80932.c: Test with ints, not with long ints.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/ubsan/pr80932.c

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

--- Comment #10 from Marek Polacek  ---
Reproduced with -m32 on x86_64.  Silly me.  Will fix.

pr80932.c:10:88: runtime error: signed integer overflow: -413853711 * -6 cannot
be represented in type 'long int'

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-08 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

--- Comment #9 from Markus Trippelsdorf  ---
trunk (checking=release):

trippels@gcc67 gcc % gcc -O0 -fsanitize=undefined
./gcc/testsuite/c-c++-common/ubsan/pr80932.c
trippels@gcc67 gcc % ./a.out
gcc/testsuite/c-c++-common/ubsan/pr80932.c:10:88: runtime error: signed integer
overflow: -9024801181724640896 - 228867929910118694 cannot be represented in
type 'long int'

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-08 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

--- Comment #8 from Markus Trippelsdorf  ---
https://gcc.gnu.org/ml/gcc-regression/2017-06/msg00104.html
https://gcc.gnu.org/ml/gcc-regression/2017-06/msg00105.html
https://gcc.gnu.org/ml/gcc-regression/2017-06/msg00107.html

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-08 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

--- Comment #7 from Marek Polacek  ---
Can't reproduce.  What arch, is that gcc or g++, ...

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-08 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

Markus Trippelsdorf  changed:

   What|Removed |Added

 CC||trippels at gcc dot gnu.org

--- Comment #6 from Markus Trippelsdorf  ---
New failures:
FAIL: c-c++-common/ubsan/pr80932.c   -O0  execution test
FAIL: c-c++-common/ubsan/pr80932.c   -O0  execution test

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Marek Polacek  ---
Fixed.

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-07 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

--- Comment #4 from Marek Polacek  ---
Author: mpolacek
Date: Wed Jun  7 11:19:40 2017
New Revision: 248961

URL: https://gcc.gnu.org/viewcvs?rev=248961=gcc=rev
Log:
PR sanitizer/80932
* fold-const.c (extract_muldiv_1) : Add
TYPE_OVERFLOW_WRAPS check. 

* c-c++-common/ubsan/pr80932.c: New test.

Added:
trunk/gcc/testsuite/c-c++-common/ubsan/pr80932.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/fold-const.c
trunk/gcc/testsuite/ChangeLog

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

--- Comment #2 from Marek Polacek  ---
Better testcase (C and C++):

int x = 1;

long int
foo (void)
{
  return ((long) (13801962912760474560ULL * x) - (long)
(15334142073106273231ULL * x)) * -6;
}

int
main ()
{
  foo ();
  return 0;
}

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-05 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #3 from Marek Polacek  ---
Should've been in ASSIGNED.

[Bug sanitizer/80932] UBSAN: false positive as a result of distribution: c1*(c2*v1-c3*v2)=>c1*c2*v1-c1*c3*v2

2017-06-01 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80932

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-06-01
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.  I'll take a look.