https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79051

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |poerpc64*-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-01-11
               Host|                            |poerpc64*-*-*
     Ever confirmed|0                           |1
              Build|                            |poerpc64*-*-*

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The test passes when the failing test case is moved into a function of its own.
 I have seen this happen before with another test that depends on VRP but I
never got to the bottom of it.

index 5ce593e..d6b7b34 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-4.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-4.c
@@ -137,7 +137,6 @@ test_int_range (int n)
   sink (f_int_1 (SAR (-3, 123)));
   sink (f_int_1 (SAR (-4, 1234)));   /* { dg-warning "argument 1 range
\\\[1235, \[0-9\]+\\\] exceeds maximum object size 1234" } */
   sink (f_int_1 (SAR (min + 1, 1233)));
-  sink (f_int_1 (SAR (min + 2, 1235)));   /* { dg-warning "argument 1 range
\\\[1236, \[0-9\]+\\\] exceeds maximum object size 1234" } */
   sink (f_int_1 (SAR (0, max)));   /* { dg-warning "argument 1 range
\\\[-\[0-9\]*, -1\\\] is negative" } */
   /* The range below includes zero which would be diagnosed by
      -Walloc-size-zero but since all other values are negative it
@@ -146,6 +145,13 @@ test_int_range (int n)
   sink (f_int_1 (SAR (2, max)));
 }

+void foobar (void)
+{
+  const int min = INT_MIN;
+
+  sink (f_int_1 (SAR (min + 2, 1235)));   /* { dg-warning "argument 1 range
\\\[1236, \[0-9\]+\\\] exceeds maximum object size 1234" } */
+}
+
 void
 test_size_cst (void)
 {

Reply via email to