Re: gcc profiling broken?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bruce Cran wrote:
andrew_terekhov@xxxxxxxxx wrote:
A simple program like this:

#include <stdio.h>

int main(int argc, char* argv[])
{
printf("Hello, world!\n");

printf("argc: %d\n", argc);

return 0;
}

when compiled with profiling:

gcc -pg -g hello.c -o hello

dumps core:

Starting program: /home/andrew/dev/kmv/components/tests/prof/cee/hello
Hello, world!

Program received signal SIGSEGV, Segmentation fault.
main (argc=Error accessing memory address 0x19: Bad address.
) at hello.c:7
7 printf("argc: %d\n", argc);


I run i386 7 beta1 from yesterday.

gcc -v
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070719 [FreeBSD]

This was previously reported in August - see the thread "gcc 4.2
profiling breaks argv". I don't think there was any resolution to the
problem.

On my VIA i386 system I don't get a segfault but argc is 80202633 when
-pg is used.

May be this is platform dependent?

# gcc -pg -g hello.c -o hello
# ./hello
Hello, world!
argc: 1

# uname -srp
FreeBSD 7.0-CURRENT arm

# cc -v
Using built-in specs.
Target: arm-undermydesk-freebsd
Configured with: FreeBSD/arm system compiler
Thread model: posix
gcc version 4.2.1 20070719 [FreeBSD]




--
Bruce

_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFHHzrFxJBWvpalMpkRAvWQAJwMLZNcZJIP61LF/j9NfkBNJNw8TgCfbHOy
ans6RdbjHGlWbQKhNq2i8ws=
=kXq3
-----END PGP SIGNATURE-----
_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Compiling FreeBSD with GCC 4.3+
    ... m= 1) that compares PC-BSD to Kubuntu. ... Kubuntu uses GCC 4.3.3 compared ... Pity it doesn't provide an unbiased comparison of FreeBSD ... compiler in FreeBSD. ...
    (freebsd-questions)
  • Re: about the gcc 3.4.x problems
    ... >>ports tree back in April. ... There was a reason why gcc34 port was kept free of local FreeBSD hacks. ... GCC tarballs as distibuted by FSF and base system version of the compiler ...
    (freebsd-current)
  • Re: FreeBSD 7.1 BETA 2 vs Opensolaris vs Ubuntu performance
    ... OTOH if the goal is to measure "operating system" performance, ... The hold on gcc 4.3 in FreeBSD is, after all, political ... They can work to make it easier to completely replace the base compiler ...
    (freebsd-performance)
  • Re: Alternatives to gcc (was Re: gcc 4.3: when will it become standard compiler?)
    ... development of PCC, so they can replace GCC in the base. ... be a solution for FreeBSD too, at least as a system compiler. ... I think that one thing that people often forget about when talking about using external compiler to build base system is that FreeBSD is not only self-hosted, but also that it supports cross-builds of any of the supported arches. ...
    (freebsd-current)
  • Re: Error compiling buildworld
    ... I'm willing to bet that the compiler tinkering you've done is causing ... I can assure you that gcc does support this option. ... doesn't understand a compiler flag from fbsd 7.0 sources? ... FreeBSD eos.sc1.parodius.com 6.3-PRERELEASE i386 ...
    (freebsd-stable)