[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2017-01-18 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ktkachov at gcc dot gnu.org

--- Comment #12 from ktkachov at gcc dot gnu.org ---
(In reply to Rainer Orth from comment #10)
> This patch introduced two issues on Solaris:
> 
> * FAIL: gcc.dg/pr78973.c  (test for warnings, line 12)
> 
>   seen on both Solaris/SPARC and x86, 32-bit only (and according to
> gcc-testresults on many other targets, too)
> 
> * XPASS: gcc.dg/attr-alloc_size-11.c missing range info for signed char
> (test for warnings, line 49)
>   XPASS: gcc.dg/attr-alloc_size-11.c missing range info for short (test for
> warnings, line 50)
> 

I see the XPASSes on arm and aarch64 as well

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2017-01-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

--- Comment #11 from Martin Sebor  ---
I've raised bug 79073 for the gcc.dg/pr78973.c failure.  AFAICT, it's due to a
VRP defect or limitation.

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2017-01-12 Thread ro at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Rainer Orth  changed:

   What|Removed |Added

 CC||ro at gcc dot gnu.org

--- Comment #10 from Rainer Orth  ---
This patch introduced two issues on Solaris:

* FAIL: gcc.dg/pr78973.c  (test for warnings, line 12)

  seen on both Solaris/SPARC and x86, 32-bit only (and according to
gcc-testresults on many other targets, too)

* XPASS: gcc.dg/attr-alloc_size-11.c missing range info for signed char (test
for warnings, line 49)
  XPASS: gcc.dg/attr-alloc_size-11.c missing range info for short (test for
warnings, line 50)

  Only seen on Solaris/SPARC, 32 and 64-bit.

  Rainer

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2017-01-10 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

--- Comment #9 from Martin Sebor  ---
Thanks for the heads up, Bill.  I opened bug 79051 for the failure.  Can you
paste the excess error(s) you see into that bug please?  (I don't see any in my
builds.)

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2017-01-10 Thread seurer at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

seurer at gcc dot gnu.org changed:

   What|Removed |Added

 CC||seurer at gcc dot gnu.org

--- Comment #8 from seurer at gcc dot gnu.org ---
One of the new tests fails on powerpc both LE and BE:

spawn /home/seurer/gcc/build/gcc-test2/gcc/xgcc
-B/home/seurer/gcc/build/gcc-test2/gcc/
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c
-fno-diagnostics-show-caret -fdiagnostics-color=never -O2 -Wall
-Walloc-size-larger-than=1234 -S -o attr-alloc_size-4.s
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c: In
function 'test_uint_cst':
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:84:3:
warning: argument 1 value '1235' exceeds maximum object size 1234
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:20:7: note:
in a call to allocation function 'f_uint_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:85:3:
warning: argument 1 value '4294967294' exceeds maximum object size 1234
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:20:7: note:
in a call to allocation function 'f_uint_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:86:3:
warning: argument 1 value '4294967295' exceeds maximum object size 1234
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:20:7: note:
in a call to allocation function 'f_uint_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c: In
function 'test_uint_range':
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:101:3:
warning: argument 1 range [1235, 1236] exceeds maximum object size 1234
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:20:7: note:
in a call to allocation function 'f_uint_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c: In
function 'test_int_cst':
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:112:3:
warning: argument 1 value '-2147483648' is negative [-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to allocation function 'f_int_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:113:3:
warning: argument 1 value '-1' is negative [-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to allocation function 'f_int_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:118:3:
warning: argument 1 value '2147483647' exceeds maximum object size 1234
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to allocation function 'f_int_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c: In
function 'test_int_range':
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:130:3:
warning: argument 1 range [-2, -1] is negative [-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to allocation function 'f_int_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:132:3:
warning: argument 1 range [1235, 2345] exceeds maximum object size 1234
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to allocation function 'f_int_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:133:3:
warning: argument 1 range [2147483646, 2147483647] exceeds maximum object size
1234 [-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to allocation function 'f_int_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:138:3:
warning: argument 1 range [1235, 2147483647] exceeds maximum object size 1234
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to allocation function 'f_int_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:141:3:
warning: argument 1 range [-2147483648, -1] is negative
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to allocation function 'f_int_1' declared here
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:145:3:
warning: argument 1 range [-2147483648, 0] is negative
[-Walloc-size-larger-than=]
/home/seurer/gcc/gcc-test2/gcc/testsuite/gcc.dg/attr-alloc_size-4.c:22:7: note:
in a call to 

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2017-01-10 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #7 from Martin Sebor  ---
Fixed in r244290.

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2017-01-10 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

--- Comment #6 from Martin Sebor  ---
Author: msebor
Date: Tue Jan 10 21:02:07 2017
New Revision: 244290

URL: https://gcc.gnu.org/viewcvs?rev=244290=gcc=rev
Log:
PR tree-optimization/78775 - [7 Regression] ICE in
maybe_warn_alloc_args_overflow

gcc/ChangeLog:

PR tree-optimization/78775
* builtins.c (get_size_range): Move...
* calls.c: ...to here.
(alloc_max_size): Accept zero argument.
(operand_signed_p): Remove.
(maybe_warn_alloc_args_overflow): Call get_size_range.
* calls.h (get_size_range): Declare.

gcc/testsuite/ChangeLog:

PR tree-optimization/78775
* gcc.dg/attr-alloc_size-4.c: Add test cases.
* gcc.dg/attr-alloc_size-10.c: New test.
* gcc.dg/attr-alloc_size-11.c: New test.
* gcc.dg/builtin-stringop-chk-7.c: New test.
* gcc.dg/pr78775.c: New test.
* gcc.dg/pr78973-2.c: New test.
* gcc.dg/pr78973.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/attr-alloc_size-10.c
trunk/gcc/testsuite/gcc.dg/attr-alloc_size-11.c
trunk/gcc/testsuite/gcc.dg/builtin-stringop-chk-7.c
trunk/gcc/testsuite/gcc.dg/pr78775.c
trunk/gcc/testsuite/gcc.dg/pr78973-2.c
trunk/gcc/testsuite/gcc.dg/pr78973.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/calls.c
trunk/gcc/calls.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/attr-alloc_size-4.c

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
Version|unknown |7.0

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #5 from Martin Sebor  ---
Patch posted for review:
https://gcc.gnu.org/ml/gcc-patches/2016-12/msg01100.html

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Martin Sebor  changed:

   What|Removed |Added

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

--- Comment #4 from Martin Sebor  ---
I've made this mistake before and should have known better.  Let me fix it.

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-12 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

--- Comment #3 from Marek Polacek  ---
So either some games with TREE_VISITED, or keep some hash_set of visited
SSA_NAMEs, or when scanning the PHI arguments, check whether its argument's
definition is also a PHI and has OP in it?

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-12 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

--- Comment #2 from Marek Polacek  ---
We're in operand_signed_p, checking whether an SSA_NAME d_4 is signed or not. 
We look at its SSA_NAME_DEF_STMT which is 
d_4 = PHI <0(2), d_5(5)>
and we walk these phi arguments, and we call operand_signed_p (d_5), but its
SSA_NAME_DEF_STMT is
d_5 = PHI 
so we call operand_signed_p (d_4) again -> loop.

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-12 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.

[Bug tree-optimization/78775] [7 Regression] ICE in maybe_warn_alloc_args_overflow

2016-12-12 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78775

Martin Liška  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
   Last reconfirmed||2016-12-12
   Target Milestone|--- |7.0