This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/11868] New: compound statement expression yields "void value not ignored"


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; }); });
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]