[Bug 1837329] [NEW] C unsed results warning when optiming

Bill Pringlemeir 1837329 at bugs.launchpad.net
Sun Jul 21 17:19:13 UTC 2019


Public bug reported:

Here is a sample program,

printf "#include <sys/uio.h>\nvoid foo(void) {\n (void)writev(1,
(void*)0, 0);\n }\n" | gcc -Wall -Wformat=2 -Wshadow -O1 -c -xc - -o
foo.o

If you change to '-O0', there is no warning.  I have  x86_64 but I doubt
that matters?  The issue is to have the warnings, but ignore by casting
the result for that particular case (next statement is abort()).

The same things happens in 4.8, 4.9, and version 5.  Maybe this is
desired?

** Affects: gcc-7 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-7 in Ubuntu.
https://bugs.launchpad.net/bugs/1837329

Title:
  C unsed results warning when optiming

Status in gcc-7 package in Ubuntu:
  New

Bug description:
  Here is a sample program,

  printf "#include <sys/uio.h>\nvoid foo(void) {\n (void)writev(1,
  (void*)0, 0);\n }\n" | gcc -Wall -Wformat=2 -Wshadow -O1 -c -xc - -o
  foo.o

  If you change to '-O0', there is no warning.  I have  x86_64 but I
  doubt that matters?  The issue is to have the warnings, but ignore by
  casting the result for that particular case (next statement is
  abort()).

  The same things happens in 4.8, 4.9, and version 5.  Maybe this is
  desired?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-7/+bug/1837329/+subscriptions



More information about the foundations-bugs mailing list