Message ID | 7340F067-09DE-41F8-95E4-939B938511EB@comcast.net |
---|---|
State | New |
Headers | show |
Series | [testsuite] ignore some "conflicting types for built-in" messages | expand |
On 11/1/18 1:13 PM, Paul Koning wrote: > A number of test cases contain declarations like: > void *memcpy(); > which currently are silently accepted on most platforms but not on all; pdp11 (and possibly some others) generate a "conflicting types for built-in function" warning. > > It was suggested to prune those messages because the test cases where these occur are not looking for the message but are testing some other issue, so the message is not relevant. The attached patch adds dg-prune-output directives to do so. > > Ok for trunk? > > paul > > ChangeLog: > > 2018-11-01 Paul Koning <ni1d@arrl.net> > > * gcc.dg/Walloca-16.c: Ignore conflicting types for built-in > warnings. > * gcc.dg/Wrestrict-4.c: Ditto. > * gcc.dg/Wrestrict-5.c: Ditto. > * gcc.dg/pr83463.c: Ditto. > * gcc.dg/torture/pr55890-2.c: Ditto. > * gcc.dg/torture/pr55890-3.c: Ditto. > * gcc.dg/torture/pr71816.c: Ditto. ISTM it'd be better to just fix memcpy to have a correct prototype. jeff
> On Nov 3, 2018, at 10:12 PM, Jeff Law <law@redhat.com> wrote: > > On 11/1/18 1:13 PM, Paul Koning wrote: >> A number of test cases contain declarations like: >> void *memcpy(); >> which currently are silently accepted on most platforms but not on all; pdp11 (and possibly some others) generate a "conflicting types for built-in function" warning. >> >> It was suggested to prune those messages because the test cases where these occur are not looking for the message but are testing some other issue, so the message is not relevant. The attached patch adds dg-prune-output directives to do so. >> >> Ok for trunk? >> >> paul >> >> ChangeLog: >> >> 2018-11-01 Paul Koning <ni1d@arrl.net> >> >> * gcc.dg/Walloca-16.c: Ignore conflicting types for built-in >> warnings. >> * gcc.dg/Wrestrict-4.c: Ditto. >> * gcc.dg/Wrestrict-5.c: Ditto. >> * gcc.dg/pr83463.c: Ditto. >> * gcc.dg/torture/pr55890-2.c: Ditto. >> * gcc.dg/torture/pr55890-3.c: Ditto. >> * gcc.dg/torture/pr71816.c: Ditto. > ISTM it'd be better to just fix memcpy to have a correct prototype. > > jeff I can do that, but I'm wondering if some systems have different prototypes than the C standard calls for so I'd end up breaking those. paul
On 11/05/2018 08:12 AM, Paul Koning wrote: > > >> On Nov 3, 2018, at 10:12 PM, Jeff Law <law@redhat.com> wrote: >> >> On 11/1/18 1:13 PM, Paul Koning wrote: >>> A number of test cases contain declarations like: >>> void *memcpy(); >>> which currently are silently accepted on most platforms but not on all; pdp11 (and possibly some others) generate a "conflicting types for built-in function" warning. >>> >>> It was suggested to prune those messages because the test cases where these occur are not looking for the message but are testing some other issue, so the message is not relevant. The attached patch adds dg-prune-output directives to do so. >>> >>> Ok for trunk? >>> >>> paul >>> >>> ChangeLog: >>> >>> 2018-11-01 Paul Koning <ni1d@arrl.net> >>> >>> * gcc.dg/Walloca-16.c: Ignore conflicting types for built-in >>> warnings. >>> * gcc.dg/Wrestrict-4.c: Ditto. >>> * gcc.dg/Wrestrict-5.c: Ditto. >>> * gcc.dg/pr83463.c: Ditto. >>> * gcc.dg/torture/pr55890-2.c: Ditto. >>> * gcc.dg/torture/pr55890-3.c: Ditto. >>> * gcc.dg/torture/pr71816.c: Ditto. >> ISTM it'd be better to just fix memcpy to have a correct prototype. >> >> jeff > > I can do that, but I'm wondering if some systems have different prototypes than the C standard calls for so I'd end up breaking those. The tests verify that GCC doesn't crash on calls to built-ins declared without a prototype. We don't want to declare them, that would defeat the purpose of the tests. Martin
On 11/5/18 8:12 AM, Paul Koning wrote: > > >> On Nov 3, 2018, at 10:12 PM, Jeff Law <law@redhat.com> wrote: >> >> On 11/1/18 1:13 PM, Paul Koning wrote: >>> A number of test cases contain declarations like: >>> void *memcpy(); >>> which currently are silently accepted on most platforms but not on all; pdp11 (and possibly some others) generate a "conflicting types for built-in function" warning. >>> >>> It was suggested to prune those messages because the test cases where these occur are not looking for the message but are testing some other issue, so the message is not relevant. The attached patch adds dg-prune-output directives to do so. >>> >>> Ok for trunk? >>> >>> paul >>> >>> ChangeLog: >>> >>> 2018-11-01 Paul Koning <ni1d@arrl.net> >>> >>> * gcc.dg/Walloca-16.c: Ignore conflicting types for built-in >>> warnings. >>> * gcc.dg/Wrestrict-4.c: Ditto. >>> * gcc.dg/Wrestrict-5.c: Ditto. >>> * gcc.dg/pr83463.c: Ditto. >>> * gcc.dg/torture/pr55890-2.c: Ditto. >>> * gcc.dg/torture/pr55890-3.c: Ditto. >>> * gcc.dg/torture/pr71816.c: Ditto. >> ISTM it'd be better to just fix memcpy to have a correct prototype. >> >> jeff > > I can do that, but I'm wondering if some systems have different prototypes than the C standard calls for so I'd end up breaking those.I wouldn't worry about those. I think the bigger question (thanks Martin) is whether or not any of those tests are checking for issues that arise specifically due to not having a full prototype available (and in those cases your fix is probably more appropriate). Probably the only way to figure that out is to dig into the history of each one :( Mighty unpleasant. jeff
> On Nov 5, 2018, at 11:45 AM, Jeff Law <law@redhat.com> wrote: > >>> ... >> >> I can do that, but I'm wondering if some systems have different prototypes than the C standard calls for so I'd end up breaking those.I wouldn't worry about those. I think the bigger question (thanks > Martin) is whether or not any of those tests are checking for issues > that arise specifically due to not having a full prototype available > (and in those cases your fix is probably more appropriate). > > Probably the only way to figure that out is to dig into the history of > each one :( Mighty unpleasant. > > jeff I took a quick look. PR83655 is specifically about an issue due to a declaration with no prototype, but the others (55890, 71816, 83463, 83603, 84244) are not so clear to me. Still, what IS clear is that none of them are interested in messages that may or may not be generated as a result of these funny declarations. In other words, pruning the messages still looks appropriate. So where do I go from here? Without the change I can deal with this by recognizing these cases as false failures when I do my test runs. paul
On 11/05/2018 11:17 AM, Paul Koning wrote: > > >> On Nov 5, 2018, at 11:45 AM, Jeff Law <law@redhat.com> wrote: >> >>>> ... >>> >>> I can do that, but I'm wondering if some systems have different prototypes than the C standard calls for so I'd end up breaking those.I wouldn't worry about those. I think the bigger question (thanks >> Martin) is whether or not any of those tests are checking for issues >> that arise specifically due to not having a full prototype available >> (and in those cases your fix is probably more appropriate). >> >> Probably the only way to figure that out is to dig into the history of >> each one :( Mighty unpleasant. >> >> jeff > > I took a quick look. PR83655 is specifically about an issue due to a declaration with no prototype, but the others (55890, 71816, 83463, 83603, 84244) are not so clear to me. Still, what IS clear is that none of them are interested in messages that may or may not be generated as a result of these funny declarations. In other words, pruning the messages still looks appropriate. > > So where do I go from here? Without the change I can deal with this by recognizing these cases as false failures when I do my test runs. The only way to determine for sure if adding a prototype won't affect the tests is to try it with the affected compiler. For tests exercising bugs in released versions of GCC on x86_64 (like for 55890) it's not too difficult to do with Godbolt(*). For tests for bugs in development versions (e.g., 71816) or it's quite a bit more time-consuming. The test for 55890 does rely on the absence of a prototype and providing it results in compilation errors. The test for 83463 also relies on it and adding the prototype prevents the ICE. Ditto for 83603 and 84224. The test for 71816 doesn't seem to depend on it. An unpatched GCC 7.0 (at r238207) still crashes after adding the prototypes. I agree with adding missing prototypes to tests that exercise the behavior of features, but it would be risky to change the source code of tests that verify the absence of an ICE. Such changes could easily have subtle effects that could compromise the efficacy of those tests. IMO, in these cases, or when in doubt, the safest thing to do is to prune their output (I wouldn't even add options to suppress warnings ince that could have similar effects). Martin [*] https://gcc.godbolt.org
Ping. I'd like to commit this. The discussion seems to have ended up with the conclusion that this is a reasonable approach. paul > On Nov 1, 2018, at 3:13 PM, Paul Koning <paulkoning@comcast.net> wrote: > > A number of test cases contain declarations like: > void *memcpy(); > which currently are silently accepted on most platforms but not on all; pdp11 (and possibly some others) generate a "conflicting types for built-in function" warning. > > It was suggested to prune those messages because the test cases where these occur are not looking for the message but are testing some other issue, so the message is not relevant. The attached patch adds dg-prune-output directives to do so. > > Ok for trunk? > > paul > > ChangeLog: > > 2018-11-01 Paul Koning <ni1d@arrl.net> > > * gcc.dg/Walloca-16.c: Ignore conflicting types for built-in > warnings. > * gcc.dg/Wrestrict-4.c: Ditto. > * gcc.dg/Wrestrict-5.c: Ditto. > * gcc.dg/pr83463.c: Ditto. > * gcc.dg/torture/pr55890-2.c: Ditto. > * gcc.dg/torture/pr55890-3.c: Ditto. > * gcc.dg/torture/pr71816.c: Ditto. > > Index: gcc.dg/Walloca-16.c > =================================================================== > --- gcc.dg/Walloca-16.c (revision 265727) > +++ gcc.dg/Walloca-16.c (working copy) > @@ -1,5 +1,6 @@ > /* PR tree-optimization/84224 */ > /* { dg-do compile } */ > +/* { dg-prune-output "conflicting types for built-in" } */ > /* { dg-options "-O0 -Walloca" } */ > > void *alloca (); > Index: gcc.dg/Wrestrict-4.c > =================================================================== > --- gcc.dg/Wrestrict-4.c (revision 265727) > +++ gcc.dg/Wrestrict-4.c (working copy) > @@ -3,6 +3,7 @@ > Test to verify that invalid calls to built-in functions declared > without a prototype don't cause an ICE. > { dg-do compile } > + { dg-prune-output "conflicting types for built-in" } > { dg-options "-O2 -Warray-bounds -Wrestrict" } */ > > void* memcpy (); > Index: gcc.dg/Wrestrict-5.c > =================================================================== > --- gcc.dg/Wrestrict-5.c (revision 265727) > +++ gcc.dg/Wrestrict-5.c (working copy) > @@ -2,6 +2,7 @@ > functions declared with no prototype are checked for overlap, and that > invalid calls are ignored. > { dg-do compile } > + { dg-prune-output "conflicting types for built-in" } > { dg-options "-O2 -Wrestrict" } */ > > typedef __SIZE_TYPE__ size_t; > Index: gcc.dg/pr83463.c > =================================================================== > --- gcc.dg/pr83463.c (revision 265727) > +++ gcc.dg/pr83463.c (working copy) > @@ -1,5 +1,6 @@ > /* PR middle-end/83463 */ > /* { dg-do compile } */ > +/* { dg-prune-output "conflicting types for built-in" } */ > /* { dg-options "-O2 -Wrestrict -Wno-pointer-to-int-cast" } */ > > int *a; > Index: gcc.dg/torture/pr55890-2.c > =================================================================== > --- gcc.dg/torture/pr55890-2.c (revision 265727) > +++ gcc.dg/torture/pr55890-2.c (working copy) > @@ -1,4 +1,5 @@ > /* { dg-do compile } */ > +/* { dg-prune-output "conflicting types for built-in" } */ > > extern void *memcpy(); > int main() { memcpy(); } > Index: gcc.dg/torture/pr55890-3.c > =================================================================== > --- gcc.dg/torture/pr55890-3.c (revision 265727) > +++ gcc.dg/torture/pr55890-3.c (working copy) > @@ -1,4 +1,5 @@ > /* { dg-do compile } */ > +/* { dg-prune-output "conflicting types for built-in" } */ > > void *memmove (); > > Index: gcc.dg/torture/pr71816.c > =================================================================== > --- gcc.dg/torture/pr71816.c (revision 265727) > +++ gcc.dg/torture/pr71816.c (working copy) > @@ -1,4 +1,5 @@ > /* { dg-do compile } */ > +/* { dg-prune-output "conflicting types for built-in" } */ > > void *ext2fs_resize_mem_p; > struct ext2_icount_el { >
On 11/9/18 7:21 AM, Paul Koning wrote: > Ping. > > I'd like to commit this. The discussion seems to have ended up with the conclusion that this is a reasonable approach. > > paul > > >> On Nov 1, 2018, at 3:13 PM, Paul Koning <paulkoning@comcast.net> wrote: >> >> A number of test cases contain declarations like: >> void *memcpy(); >> which currently are silently accepted on most platforms but not on all; pdp11 (and possibly some others) generate a "conflicting types for built-in function" warning. >> >> It was suggested to prune those messages because the test cases where these occur are not looking for the message but are testing some other issue, so the message is not relevant. The attached patch adds dg-prune-output directives to do so. >> >> Ok for trunk? >> >> paul >> >> ChangeLog: >> >> 2018-11-01 Paul Koning <ni1d@arrl.net> >> >> * gcc.dg/Walloca-16.c: Ignore conflicting types for built-in >> warnings. >> * gcc.dg/Wrestrict-4.c: Ditto. >> * gcc.dg/Wrestrict-5.c: Ditto. >> * gcc.dg/pr83463.c: Ditto. >> * gcc.dg/torture/pr55890-2.c: Ditto. >> * gcc.dg/torture/pr55890-3.c: Ditto. >> * gcc.dg/torture/pr71816.c: Ditto. OK. Thanks for being patient with the round and round on this one. jeff
Index: gcc.dg/Walloca-16.c =================================================================== --- gcc.dg/Walloca-16.c (revision 265727) +++ gcc.dg/Walloca-16.c (working copy) @@ -1,5 +1,6 @@ /* PR tree-optimization/84224 */ /* { dg-do compile } */ +/* { dg-prune-output "conflicting types for built-in" } */ /* { dg-options "-O0 -Walloca" } */ void *alloca (); Index: gcc.dg/Wrestrict-4.c =================================================================== --- gcc.dg/Wrestrict-4.c (revision 265727) +++ gcc.dg/Wrestrict-4.c (working copy) @@ -3,6 +3,7 @@ Test to verify that invalid calls to built-in functions declared without a prototype don't cause an ICE. { dg-do compile } + { dg-prune-output "conflicting types for built-in" } { dg-options "-O2 -Warray-bounds -Wrestrict" } */ void* memcpy (); Index: gcc.dg/Wrestrict-5.c =================================================================== --- gcc.dg/Wrestrict-5.c (revision 265727) +++ gcc.dg/Wrestrict-5.c (working copy) @@ -2,6 +2,7 @@ functions declared with no prototype are checked for overlap, and that invalid calls are ignored. { dg-do compile } + { dg-prune-output "conflicting types for built-in" } { dg-options "-O2 -Wrestrict" } */ typedef __SIZE_TYPE__ size_t; Index: gcc.dg/pr83463.c =================================================================== --- gcc.dg/pr83463.c (revision 265727) +++ gcc.dg/pr83463.c (working copy) @@ -1,5 +1,6 @@ /* PR middle-end/83463 */ /* { dg-do compile } */ +/* { dg-prune-output "conflicting types for built-in" } */ /* { dg-options "-O2 -Wrestrict -Wno-pointer-to-int-cast" } */ int *a; Index: gcc.dg/torture/pr55890-2.c =================================================================== --- gcc.dg/torture/pr55890-2.c (revision 265727) +++ gcc.dg/torture/pr55890-2.c (working copy) @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-prune-output "conflicting types for built-in" } */ extern void *memcpy(); int main() { memcpy(); } Index: gcc.dg/torture/pr55890-3.c =================================================================== --- gcc.dg/torture/pr55890-3.c (revision 265727) +++ gcc.dg/torture/pr55890-3.c (working copy) @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-prune-output "conflicting types for built-in" } */ void *memmove (); Index: gcc.dg/torture/pr71816.c =================================================================== --- gcc.dg/torture/pr71816.c (revision 265727) +++ gcc.dg/torture/pr71816.c (working copy) @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-prune-output "conflicting types for built-in" } */ void *ext2fs_resize_mem_p; struct ext2_icount_el {