public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Testing build failure with latest GCC
@ 2017-05-25 16:50 Steve Ellcey
  2017-05-25 16:56 ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Ellcey @ 2017-05-25 16:50 UTC (permalink / raw)
  To: libc-alpha

I am building the top-of-tree glibc with top-of-tree gcc and getting
these messages when running 'make check'.  Should we explicitly ignore
the return value of fgets in these tests or check it and set 'failed'
if it is not the expected value?  Or do we think GCC is at fault?  It
seems like a legimate warning and we do compile with -Wall -Werror.

Steve Ellcey
sellcey@cavium.com

test-assert.c: In function ‘main’:
test-assert.c:75:3: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
   fgets (buf, 160, stderr);
   ^
test-assert.c:79:3: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
   fgets (buf, 160, stderr);
   ^
test-assert.c:83:3: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
   fgets (buf, 160, stderr);
test-assert-perr.c: In function ‘main’:
test-assert-perr.c:73:3: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
   fgets (buf, 160, stderr);
   ^
test-assert-perr.c:77:3: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
   fgets (buf, 160, stderr);
   ^
test-assert-perr.c:81:3: error: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Werror=unused-result]
   fgets (buf, 160, stderr);
   ^
cc1: all warnings being treated as errors

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Testing build failure with latest GCC
  2017-05-25 16:50 Testing build failure with latest GCC Steve Ellcey
@ 2017-05-25 16:56 ` Florian Weimer
  2017-05-25 17:05   ` Steve Ellcey
  2017-05-25 17:14   ` Steve Ellcey
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Weimer @ 2017-05-25 16:56 UTC (permalink / raw)
  To: sellcey; +Cc: libc-alpha

On Thu, May 25, 2017 at 6:50 PM, Steve Ellcey <sellcey@cavium.com> wrote:
> I am building the top-of-tree glibc with top-of-tree gcc and getting
> these messages when running 'make check'.  Should we explicitly ignore
> the return value of fgets in these tests or check it and set 'failed'
> if it is not the expected value?  Or do we think GCC is at fault?  It
> seems like a legimate warning and we do compile with -Wall -Werror.

Any idea why it didn't warn before?

The f* stream functions are special. You can check for errors using
the return value, or using ferror. Therefore, the attribute might not
be correct.

Considering how difficult is to bypass warn-used attribute (a cast to
void is not enough), I wonder if we should drop the attribute.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Testing build failure with latest GCC
  2017-05-25 16:56 ` Florian Weimer
@ 2017-05-25 17:05   ` Steve Ellcey
  2017-05-29 14:27     ` Cyril Hrubis
  2017-05-25 17:14   ` Steve Ellcey
  1 sibling, 1 reply; 5+ messages in thread
From: Steve Ellcey @ 2017-05-25 17:05 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

On Thu, 2017-05-25 at 18:56 +0200, Florian Weimer wrote:
> On Thu, May 25, 2017 at 6:50 PM, Steve Ellcey <sellcey@cavium.com>
> wrote:
> > 
> > I am building the top-of-tree glibc with top-of-tree gcc and getting
> > these messages when running 'make check'.  Should we explicitly ignore
> > the return value of fgets in these tests or check it and set 'failed'
> > if it is not the expected value?  Or do we think GCC is at fault?  It
> > seems like a legimate warning and we do compile with -Wall -Werror.
> Any idea why it didn't warn before?

No I don't know why it didn't warn before.  I assume it is a recent GCC
change but I don't know what change.  I'll see if I can track down a
specific change that caused this to start.

> The f* stream functions are special. You can check for errors using
> the return value, or using ferror. Therefore, the attribute might not
> be correct.
> 
> Considering how difficult is to bypass warn-used attribute (a cast to
> void is not enough), I wonder if we should drop the attribute.

That is a good point, I thought a '(void)' cast could fix this but I
see that it does not.

Steve Ellcey

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Testing build failure with latest GCC
  2017-05-25 16:56 ` Florian Weimer
  2017-05-25 17:05   ` Steve Ellcey
@ 2017-05-25 17:14   ` Steve Ellcey
  1 sibling, 0 replies; 5+ messages in thread
From: Steve Ellcey @ 2017-05-25 17:14 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

On Thu, 2017-05-25 at 18:56 +0200, Florian Weimer wrote:
> 
> The f* stream functions are special. You can check for errors using
> the return value, or using ferror. Therefore, the attribute might not
> be correct.
> 
> Considering how difficult is to bypass warn-used attribute (a cast to
> void is not enough), I wonder if we should drop the attribute.
> 
> Thanks,
> Florian

I think this is a bug in my scripts.  I thought I was compiling with
the top-of-tree GCC but it looks like I was actually compiling with GCC
5.4 when building the tests (bad path).  The actual library however was
compiled with ToT GCC and I think that mixing of building the library
with ToT GCC and the tests with GCC 5.4 is causing the problem.

I think we can just call this a user error.

Steve Ellcey
sellcey@cavium.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Testing build failure with latest GCC
  2017-05-25 17:05   ` Steve Ellcey
@ 2017-05-29 14:27     ` Cyril Hrubis
  0 siblings, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2017-05-29 14:27 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: Florian Weimer, libc-alpha

Hi!
> > The f* stream functions are special. You can check for errors using
> > the return value, or using ferror. Therefore, the attribute might not
> > be correct.
> > 
> > Considering how difficult is to bypass warn-used attribute (a cast to
> > void is not enough), I wonder if we should drop the attribute.
> 
> That is a good point, I thought a '(void)' cast could fix this but I
> see that it does not.

FYI that's bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-29 14:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25 16:50 Testing build failure with latest GCC Steve Ellcey
2017-05-25 16:56 ` Florian Weimer
2017-05-25 17:05   ` Steve Ellcey
2017-05-29 14:27     ` Cyril Hrubis
2017-05-25 17:14   ` Steve Ellcey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).