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/26533] New: error: invalid use of void expression


This is probably pretty dodgy C code, but I
find it strange that program foo.c compiles
while program bar.c gives an error.  Is this
a bug?

----------- foo.c --------------
#include <stdio.h>

int main()

{
  int ii;

  ii = 276;
  void *vv = (void *)&ii;
}
----------- foo.c --------------

----------- bar.c --------------
#include <stdio.h>

int main()

{
  int ii;
  void *vv;

  ii = 276;
  *vv = (void *)&ii;
}
----------- bar.c --------------

% gcc -o foo foo.c
% gcc -o bar bar.c
bar.c: In function ESC)B?main?:
bar.c:10: warning: dereferencing ESC)B?void *? pointer
bar.c:10: error: invalid use of void expression
%

For completeness on this report, this was on

% gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /usr/local/gcc-4.0.2/src/gcc-4.0.2/configure
--enable-languages=c --prefix=/usr/local/gcc-4.0.2/x86-Linux
Thread model: posix
gcc version 4.0.2
%


-- 
           Summary: error: invalid use of void expression
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kminola at eng dot umd dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26533


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