From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0rc2) Gecko/20020510 Description of problem: gcc 2.96-110 refuses to perform the implicit cast from void* to int* in C mode. gcc 2.96-98, gcc 3.1, gcc 2.95.3, MSVC 6 and Comeau 4.3 compile the code. gcc 2.96-98 compiles the ORB MICO (www.mico.org), gcc 2.96-110 does not because a code fragment similar to this one shows up in C code generated by Bison. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1.gcc cast.c 2. 3. Actual Results: cast.c: In function `int main ()': cast.c:6: cannot convert `void *' to `int *' for argument `1' to `f (int *)' Expected Results: Should compile. Additional info: void f(int* i) {} int main(void) { void* v=0; f(v); return 0; }
Works for me just fine: gcc -W -Wall n.c n.c: In function `f': n.c:1: warning: unused parameter `i' gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-110) My guess is you used the g++ driver, in that case you really get that error: g++ -W -Wall n.c n.c: In function `void f (int *)': n.c:1: warning: unused parameter `int *i' n.c: In function `int main ()': n.c:6: cannot convert `void *' to `int *' for argument `1' to `f (int *)' but that's correct, C++ doesn't allow this and running g++ on a .c file compiles it as C++. You get similar error from gcc 3.1: g++3 -W -Wall n.c n.c: In function `void f(int*)': n.c:1: warning: unused parameter `int*i' n.c: In function `int main()': n.c:6: invalid conversion from `void*' to `int*' g++3 -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.1/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib Thread model: posix gcc version 3.1 20020525 (Red Hat Linux 7.3 3.1-3)
You are absolutely right. For some reason /usr/bin/gcc was a softlink to /usr/bin/g++. After restoring gcc via rpm it worked. Sorry for the false bug report.