Bug 126488

Summary: Compiling with gcc -pg produces immediately crashing executables
Product: Base System Reporter: Ronald F. Guilmette <rfg>
Component: gnuAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 7.0-RELEASE   
Hardware: Any   
OS: Any   

Description Ronald F. Guilmette 2008-08-13 02:30:02 UTC
	Compiling & linking just about any program with "gcc -pg" produces
	either an executable that crashes instantly, just inside of main()
	or else an executable where the argc and argv values are hopelessly
	hosed (which can be almost as bad).

Fix: 

Beats me.  I haven't been working on the compiler in some time now.
	I'll help to sort this out, but only if you can't find anybody else
	who's been grunging around in the GCC code more recently than me.
How-To-Repeat: 	Save the following trivial source file as "test.c" and then compile
	and execute it thusly:

		gcc -pg -o test test.c
		./test

	#include <stdlib.h>
	
	int
	main (register int const argc, register char **const argv)
	{
	  if (!argv) {
	    abort ();
	    return 1;
	  } else
	    return 0;
	}

	...then stand back and watch as the program core dumps.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-08-13 02:43:17 UTC
State Changed
From-To: open->feedback

Does this patch help? 
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/include/profile.h
Comment 2 edwin 2008-08-14 01:52:42 UTC
On Wed, Aug 13, 2008 at 05:10:27PM -0700, Ronald F. Guilmette wrote:
> In message <200808130143.m7D1hXIl090476@freefall.freebsd.org>, you wrote:
> 
> >Synopsis: Compiling with gcc -pg produces immediately crashing executables
> >
> >State-Changed-From-To: open->feedback
> >State-Changed-By: edwin
> >State-Changed-When: Wed Aug 13 01:43:17 UTC 2008
> >State-Changed-Why: 
> >Does this patch help?
> >http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/i386/include/profile.h
> >
> >http://www.freebsd.org/cgi/query-pr.cgi?pr=126488
>
> Probably.  Do you need me to check for sure?
> 
> Do I need to rebuild & reinstall the kernel in order to do that?

I think you need a full rebuild (at least kernel) for this.

Edwin

-- 
Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin@mavetju.org    |              Weblog: http://www.mavetju.org/weblog/
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2008-08-14 05:32:00 UTC
State Changed
From-To: feedback->closed

Closed on submitters request in favour of bin/119709.