gcc 4.2 profiling breaks argv

From: Niklas Sorensson <nik_at_cs.chalmers.se>
Date: Sat, 04 Aug 2007 19:50:56 +0200
Hi,

following up on the thread started by Nick Frampton yesterday:

I can repeat the problem, although it looks slightly different. Instead of 
crashing when argv is accessed, both argc and argv are zero. This behavior is 
triggered by both gcc 4.2.0 and 4.2.1:

nik> cat test.c
#include <stdio.h>
int main (int argc, char **argv) {
    fprintf (stderr, "argc=%d, argv=%p\n", argc, argv);
    return 0;
}
nik> cc -c -o test.o -pg  test.c &&  cc -o test  -pg  test.o
nik> ./test
argc=0, argv=0x0

nik> gcc42 -c -o test.o -pg  test.c && gcc42 -o test  -pg  test.o
nik> ./test
argc=0, argv=0x0

nik> cc -v
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.0 20070514 [FreeBSD]

nik> gcc42 -v
Using built-in specs.
Target: i386-portbld-freebsd7.0
Configured with: ./..//gcc-4.2.1-RC-20070712/configure --disable-nls 
--with-system-zlib --with-libiconv-prefix=/usr/local --with-gmp=/usr/local 
--program-suffix=42 --libdir=/usr/local/lib/gcc-4.2.1 
--with-gxx-include-dir=/usr/local/lib/gcc-4.2.1/include/c++/ --disable-libgcj 
--prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc42 
i386-portbld-freebsd7.0
Thread model: posix
gcc version 4.2.1 20070712 (prerelease)

nik> uname -a
FreeBSD apa 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Fri Aug  3 18:08:53 CEST 2007 
   root_at_apa:/usr/obj/usr/src/sys/APA  i386

Incidentally, I noticed that lang/gcc42 fails to build unless GNU awk is 
installed. There is at least one awk-script used during the build that produces 
the wrong result with the default awk. I think other gcc-based ports may be 
affected, since I observed the same problem with lang/llvm-gcc4.

Cheers,

/Niklas
Received on Sat Aug 04 2007 - 16:22:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:15 UTC