public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/11868] New: compound statement expression yields "void value not ignored"
@ 2003-08-09 13:20 bradley-k-gnubugzilla dot 29cd01 at bradley dot lcs dot mit dot edu
2003-08-09 13:25 ` [Bug c/11868] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: bradley-k-gnubugzilla dot 29cd01 at bradley dot lcs dot mit dot edu @ 2003-08-09 13:20 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11868
Summary: compound statement expression yields "void value not
ignored"
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bradley-k-gnubugzilla dot 29cd01 at bradley dot lcs dot
mit dot edu
CC: gcc-bugs at gcc dot gnu dot org
OVERVIEW:
gcc incorrectly produces "error: void value not ignored as it ought to be" on
this function:
int f1(void)
{ return ({ { 0; } }); }
HOW TO REPRODUCE:
Put that function into a file void-error.c and compile it.
ACTUAL RESULTS:
The compiler complains and does not compile the code.
$ gcc -c void-error.c
void-error.c: In function `f1':
void-error.c:3: error: void value not ignored as it ought to be
EXPECTED RESULTS:
This code should compile.
BUILD DATE AND PLATFORM:
I downloaded gcc-3.3.1.tar.bz2 on August 8, 2003 and did
./configure --prefix ~/gcc-3.3.1/ && make && make install
I am running on fully up-to-date redhat 7.3 (Linux) on a Pentium IV.
ADDITIONAL INFORMATION:
Here is more verbose output.
$ gcc -c void-error.c -v
Reading specs from
/home/bradley/gcc-3.3.1/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: ./configure --prefix /home/bradley/gcc-3.3.1/
Thread model: posix
gcc version 3.3.1
/home/bradley/gcc-3.3.1/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.1/cc1 -quiet
-v -iprefix /home/bradley/gcc-3.3.1/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.3.1/
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=1 void-error.c -quiet
-dumpbase void-error.c -auxbase void-error -version -o /tmp/ccfSVKis.s
GNU C version 3.3.1 (i686-pc-linux-gnu)
compiled by GNU C version 3.2.1.
GGC heuristics: --param ggc-min-expand=81 --param ggc-min-heapsize=96511
ignoring nonexistent directory "/home/bradley/gcc-3.3.1/i686-pc-linux-gnu/include"
ignoring nonexistent directory "/home/bradley/gcc-3.3.1/i686-pc-linux-gnu/include"
ignoring duplicate directory
"/home/bradley/gcc-3.3.1/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/include"
#include "..." search starts here:
#include <...> search starts here:
/home/bradley/gcc-3.3.1/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/include
/usr/local/include
/home/bradley/gcc-3.3.1/include
/usr/include
End of search list.
void-error.c: In function `f1':
void-error.c:3: error: void value not ignored as it ought to be
Other notes: I also get this warning with gcc 3.2.1 similarly installed.
I don't get this warning with the gcc 2.96 that comes with redhat 7.3.
I tried downloading gcc 3.4, but could not get it to work today.
If you add parens the error goes away:
int f2(void) /* This function is OK. */
{
return ({ ({ 0; }); });
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/11868] compound statement expression yields "void value not ignored"
2003-08-09 13:20 [Bug c/11868] New: compound statement expression yields "void value not ignored" bradley-k-gnubugzilla dot 29cd01 at bradley dot lcs dot mit dot edu
@ 2003-08-09 13:25 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-09 13:25 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11868
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
Summary|compound statement |compound statement
|expression yields "void |expression yields "void
|value not ignored" |value not ignored"
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-08-09 13:25 -------
The code is invalid as { 0 } is a void value while ({ 0 }) is the compound statement extension.
So adding the parens just changes { 0 } into a compound statement.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-08-09 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-09 13:20 [Bug c/11868] New: compound statement expression yields "void value not ignored" bradley-k-gnubugzilla dot 29cd01 at bradley dot lcs dot mit dot edu
2003-08-09 13:25 ` [Bug c/11868] " pinskia at gcc dot gnu dot org
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).