diff mbox

Fix PR64764

Message ID 54D88C34.7050606@mentor.com
State New
Headers show

Commit Message

Tom de Vries Feb. 9, 2015, 10:30 a.m. UTC
On 09-02-15 09:59, Richard Biener wrote:
> On Thu, 5 Feb 2015, Tom de Vries wrote:
>
>> On 26-01-15 15:47, Richard Biener wrote:
>>> Index: gcc/testsuite/gcc.dg/uninit-19.c
>>> ===================================================================
>>> --- gcc/testsuite/gcc.dg/uninit-19.c	(revision 0)
>>> +++ gcc/testsuite/gcc.dg/uninit-19.c	(working copy)
>>> @@ -0,0 +1,23 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "-O -Wuninitialized" } */
>>> +
>>> +int a, l, m;
>>> +float *b;
>>> +float c, d, e, g, h;
>>> +unsigned char i, k;
>>> +void
>>> +fn1 (int p1, float *f1, float *f2, float *f3, unsigned char *c1, float *f4,
>>> +     unsigned char *c2, float *p10)
>>> +{
>>> +  if (p1 & 8)
>>> +    b[3] = p10[a];  /* { dg-warning "may be used uninitialized" } */
>>> +}
>>> +
>>> +void
>>> +fn2 ()
>>> +{
>>> +  float *n;
>>> +  if (l & 6)
>>> +    n = &c + m;
>>> +  fn1 (l, &d, &e, &g, &i, &h, &k, n);
>>> +}
>>
>> Hi Richard,
>>
>> this new test fails with -fpic, because fn1 is not inlined.
>>
>> Adding static to fn1 allows it to pass both with and without -fpic. But that
>> change might affect whether it still serves as a regression test for this PR,
>> I'm not sure.
>>
>> Another way to fix this could be to use the warning line number 22 instead 13
>> for fpic.
>
> Either way is fine with me.
>

Committed using the method of different line number for -fpic.

Thanks,
- Tom

2015-02-09  Tom de Vries  <tom@codesourcery.com>

	* gcc.dg/uninit-19.c: Fix warning line for fpic.
---
  gcc/testsuite/gcc.dg/uninit-19.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

  void
@@ -19,5 +19,8 @@ fn2 ()
    float *n;
    if (l & 6)
      n = &c + m;
-  fn1 (l, &d, &e, &g, &i, &h, &k, n);
+  fn1 (l, &d, &e, &g, &i, &h, &k, n);  /* 22.  */
  }
+
+/* { dg-warning "may be used uninitialized" "" { target nonpic } 13 } */
+/* { dg-warning "may be used uninitialized" "" { target { ! nonpic } } 22 } */

Comments

H.J. Lu March 16, 2016, 4:12 p.m. UTC | #1
On Mon, Feb 9, 2015 at 2:30 AM, Tom de Vries <Tom_deVries@mentor.com> wrote:
> On 09-02-15 09:59, Richard Biener wrote:
>>
>> On Thu, 5 Feb 2015, Tom de Vries wrote:
>>
>>> On 26-01-15 15:47, Richard Biener wrote:
>>>>
>>>> Index: gcc/testsuite/gcc.dg/uninit-19.c
>>>> ===================================================================
>>>> --- gcc/testsuite/gcc.dg/uninit-19.c    (revision 0)
>>>> +++ gcc/testsuite/gcc.dg/uninit-19.c    (working copy)
>>>> @@ -0,0 +1,23 @@
>>>> +/* { dg-do compile } */
>>>> +/* { dg-options "-O -Wuninitialized" } */
>>>> +
>>>> +int a, l, m;
>>>> +float *b;
>>>> +float c, d, e, g, h;
>>>> +unsigned char i, k;
>>>> +void
>>>> +fn1 (int p1, float *f1, float *f2, float *f3, unsigned char *c1, float
>>>> *f4,
>>>> +     unsigned char *c2, float *p10)
>>>> +{
>>>> +  if (p1 & 8)
>>>> +    b[3] = p10[a];  /* { dg-warning "may be used uninitialized" } */
>>>> +}
>>>> +
>>>> +void
>>>> +fn2 ()
>>>> +{
>>>> +  float *n;
>>>> +  if (l & 6)
>>>> +    n = &c + m;
>>>> +  fn1 (l, &d, &e, &g, &i, &h, &k, n);
>>>> +}
>>>
>>>
>>> Hi Richard,
>>>
>>> this new test fails with -fpic, because fn1 is not inlined.
>>>
>>> Adding static to fn1 allows it to pass both with and without -fpic. But
>>> that
>>> change might affect whether it still serves as a regression test for this
>>> PR,
>>> I'm not sure.
>>>
>>> Another way to fix this could be to use the warning line number 22
>>> instead 13
>>> for fpic.
>>
>>
>> Either way is fine with me.
>>
>
> Committed using the method of different line number for -fpic.
>
> Thanks,
> - Tom
>
> 2015-02-09  Tom de Vries  <tom@codesourcery.com>
>
>         * gcc.dg/uninit-19.c: Fix warning line for fpic.
> ---
>  gcc/testsuite/gcc.dg/uninit-19.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.dg/uninit-19.c
> b/gcc/testsuite/gcc.dg/uninit-19.c
> index 3113cab..fc7acea 100644
> --- a/gcc/testsuite/gcc.dg/uninit-19.c
> +++ b/gcc/testsuite/gcc.dg/uninit-19.c
> @@ -10,7 +10,7 @@ fn1 (int p1, float *f1, float *f2, float *f3, unsigned
> char *c1, float *f4,
>       unsigned char *c2, float *p10)
>  {
>    if (p1 & 8)
> -    b[3] = p10[a];  /* { dg-warning "may be used uninitialized" } */
> +    b[3] = p10[a];  /* 13.  */
>  }
>
>  void
> @@ -19,5 +19,8 @@ fn2 ()
>    float *n;
>    if (l & 6)
>      n = &c + m;
> -  fn1 (l, &d, &e, &g, &i, &h, &k, n);
> +  fn1 (l, &d, &e, &g, &i, &h, &k, n);  /* 22.  */
>  }
> +
> +/* { dg-warning "may be used uninitialized" "" { target nonpic } 13 } */
> +/* { dg-warning "may be used uninitialized" "" { target { ! nonpic } } 22 }
> */
> --
> 1.9.1
>

Any particular reason why this test was changed to DOS format?
H.J. Lu March 16, 2016, 4:15 p.m. UTC | #2
On Wed, Mar 16, 2016 at 9:12 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Mon, Feb 9, 2015 at 2:30 AM, Tom de Vries <Tom_deVries@mentor.com> wrote:
>> On 09-02-15 09:59, Richard Biener wrote:
>>>
>>> On Thu, 5 Feb 2015, Tom de Vries wrote:
>>>
>>>> On 26-01-15 15:47, Richard Biener wrote:
>>>>>
>>>>> Index: gcc/testsuite/gcc.dg/uninit-19.c
>>>>> ===================================================================
>>>>> --- gcc/testsuite/gcc.dg/uninit-19.c    (revision 0)
>>>>> +++ gcc/testsuite/gcc.dg/uninit-19.c    (working copy)
>>>>> @@ -0,0 +1,23 @@
>>>>> +/* { dg-do compile } */
>>>>> +/* { dg-options "-O -Wuninitialized" } */
>>>>> +
>>>>> +int a, l, m;
>>>>> +float *b;
>>>>> +float c, d, e, g, h;
>>>>> +unsigned char i, k;
>>>>> +void
>>>>> +fn1 (int p1, float *f1, float *f2, float *f3, unsigned char *c1, float
>>>>> *f4,
>>>>> +     unsigned char *c2, float *p10)
>>>>> +{
>>>>> +  if (p1 & 8)
>>>>> +    b[3] = p10[a];  /* { dg-warning "may be used uninitialized" } */
>>>>> +}
>>>>> +
>>>>> +void
>>>>> +fn2 ()
>>>>> +{
>>>>> +  float *n;
>>>>> +  if (l & 6)
>>>>> +    n = &c + m;
>>>>> +  fn1 (l, &d, &e, &g, &i, &h, &k, n);
>>>>> +}
>>>>
>>>>
>>>> Hi Richard,
>>>>
>>>> this new test fails with -fpic, because fn1 is not inlined.
>>>>
>>>> Adding static to fn1 allows it to pass both with and without -fpic. But
>>>> that
>>>> change might affect whether it still serves as a regression test for this
>>>> PR,
>>>> I'm not sure.
>>>>
>>>> Another way to fix this could be to use the warning line number 22
>>>> instead 13
>>>> for fpic.
>>>
>>>
>>> Either way is fine with me.
>>>
>>
>> Committed using the method of different line number for -fpic.
>>
>> Thanks,
>> - Tom
>>
>> 2015-02-09  Tom de Vries  <tom@codesourcery.com>
>>
>>         * gcc.dg/uninit-19.c: Fix warning line for fpic.
>> ---
>>  gcc/testsuite/gcc.dg/uninit-19.c | 7 +++++--
>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/gcc/testsuite/gcc.dg/uninit-19.c
>> b/gcc/testsuite/gcc.dg/uninit-19.c
>> index 3113cab..fc7acea 100644
>> --- a/gcc/testsuite/gcc.dg/uninit-19.c
>> +++ b/gcc/testsuite/gcc.dg/uninit-19.c
>> @@ -10,7 +10,7 @@ fn1 (int p1, float *f1, float *f2, float *f3, unsigned
>> char *c1, float *f4,
>>       unsigned char *c2, float *p10)
>>  {
>>    if (p1 & 8)
>> -    b[3] = p10[a];  /* { dg-warning "may be used uninitialized" } */
>> +    b[3] = p10[a];  /* 13.  */
>>  }
>>
>>  void
>> @@ -19,5 +19,8 @@ fn2 ()
>>    float *n;
>>    if (l & 6)
>>      n = &c + m;
>> -  fn1 (l, &d, &e, &g, &i, &h, &k, n);
>> +  fn1 (l, &d, &e, &g, &i, &h, &k, n);  /* 22.  */
>>  }
>> +
>> +/* { dg-warning "may be used uninitialized" "" { target nonpic } 13 } */
>> +/* { dg-warning "may be used uninitialized" "" { target { ! nonpic } } 22 }
>> */
>> --
>> 1.9.1
>>
>
> Any particular reason why this test was changed to DOS format?
>

I ran dos2unix on gcc.dg/uninit-19.c and checked it in.
Tom de Vries March 16, 2016, 4:35 p.m. UTC | #3
On 16/03/16 17:15, H.J. Lu wrote:
> On Wed, Mar 16, 2016 at 9:12 AM, H.J. Lu <hjl.tools@gmail.com> wrote:

>> Any particular reason why this test was changed to DOS format?

FWIW, the test was in DOS format from the start.

Thanks
- Tom
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.dg/uninit-19.c b/gcc/testsuite/gcc.dg/uninit-19.c
index 3113cab..fc7acea 100644
--- a/gcc/testsuite/gcc.dg/uninit-19.c
+++ b/gcc/testsuite/gcc.dg/uninit-19.c
@@ -10,7 +10,7 @@  fn1 (int p1, float *f1, float *f2, float *f3, unsigned char 
*c1, float *f4,
       unsigned char *c2, float *p10)
  {
    if (p1 & 8)
-    b[3] = p10[a];  /* { dg-warning "may be used uninitialized" } */
+    b[3] = p10[a];  /* 13.  */
  }