From nobody@FreeBSD.org  Sat Oct 14 18:28:08 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 8D20616A403
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Oct 2006 18:28:08 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9F04E43D8D
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Oct 2006 18:27:59 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k9EIRw9Q021789
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 14 Oct 2006 18:27:58 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k9EIRwde021787;
	Sat, 14 Oct 2006 18:27:58 GMT
	(envelope-from nobody)
Message-Id: <200610141827.k9EIRwde021787@www.freebsd.org>
Date: Sat, 14 Oct 2006 18:27:58 GMT
From: Wes Peters<wes@softweyr.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: c++ vs. fesetenv: undefined reference to __test_sse()
X-Send-Pr-Version: www-3.0

>Number:         104425
>Category:       bin
>Synopsis:       c++ vs. fesetenv: undefined reference to __test_sse()
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    wes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 14 18:30:19 GMT 2006
>Closed-Date:    Wed Nov 08 03:46:33 GMT 2006
>Last-Modified:  Wed Nov 08 03:46:33 GMT 2006
>Originator:     Wes Peters
>Release:        6.2-PRERELEASE
>Organization:
FreeBSD
>Environment:
FreeBSD zaphod.softweyr.com 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #4: Thu Oct 12 08:51:53 PDT 2006     rootb@zaphod.softweyr.com:/usr/obj/usr/src/sys/ZAPHOD  i386
>Description:
wes@zaphod$ cat hello.cc
#include <iostream>
#include <fenv.h>

using namespace std;

int main(int argc, char *argv[])
{
        fenv_t envp;
        int i = fegetenv(&envp);
        fesetenv(&envp);
        cout << "Hello, world" << endl;
}

wes@zaphod$ c++ -g hello.cc -lm
/var/tmp//ccgJGfUg.o(.text+0x1b6): In function `fesetenv':
/usr/include/fenv.h:211: undefined reference to `__test_sse()'

The problem seems to lie in the C++ runtime startup, the nearly identical C program has no problems:

wes@zaphod$ cat hello.c
#include <stdio.h>
#include <fenv.h>
#pragma STDC FENV_ACCESS ON

int main(int argc, char *argv[])
{
        fenv_t envp;
        int i = fegetenv(&envp);
        fesetenv(&envp);
        printf("Hello, world\n");
}
wes@zaphod$ cc -g hello.c -lm
wes@zaphod$ ./a.out
Hello, world

>How-To-Repeat:
Attempt to compile any C++ program that calls fesetenv.
>Fix:
Still working on it.  This may be a show-stopper for release, if we care about C++ and floating-point support.
>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/104425: commit references a PR
Date: Sat, 14 Oct 2006 20:36:13 +0000 (UTC)

 bde         2006-10-14 20:35:56 UTC
 
   FreeBSD src repository
 
   Modified files:
     lib/msun/i387        fenv.h 
   Log:
   Moved __BEGIN_DECLS up a little so that it covers __test_sse() and C++
   isn't broken,
   
   PR:             104425
   
   Revision  Changes    Path
   1.5       +2 -2      src/lib/msun/i387/fenv.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: Bruce Evans <bde@zeta.org.au>
To: Wes Peters <wes@softweyr.com>
Cc: freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Subject: Re: bin/104425: c++ vs. fesetenv: undefined reference to __test_sse()
Date: Sun, 15 Oct 2006 06:39:53 +1000 (EST)

 On Sat, 14 Oct 2006, Wes Peters wrote:
 
 >> Description:
 > ...
 > wes@zaphod$ c++ -g hello.cc -lm
 > /var/tmp//ccgJGfUg.o(.text+0x1b6): In function `fesetenv':
 > /usr/include/fenv.h:211: undefined reference to `__test_sse()'
 
 Fixed in fenv.h 1.5 in -current.
 
 You get to MFC it.
 
 Bruce
Responsible-Changed-From-To: freebsd-bugs->wes 
Responsible-Changed-By: wes 
Responsible-Changed-When: Sun Oct 15 02:58:54 UTC 2006 
Responsible-Changed-Why:  
I'll take over the testing and MFC; thanks to Bruce for the quick fix. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104425 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/104425: commit references a PR
Date: Thu, 19 Oct 2006 15:52:58 +0000 (UTC)

 wes         2006-10-19 15:52:19 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     lib/msun/i387        fenv.h 
   Log:
   MFC r1.5 so C++ programs will work in 6.2.  Thanks for the fix, Bruce.
   
   Moved __BEGIN_DECLS up a little so that it covers __test_sse() and C++
   isn't broken,
   
   PR:             104425
   Approved by:    re (bmah)
   
   Revision  Changes    Path
   1.4.2.1   +2 -2      src/lib/msun/i387/fenv.h
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: wes 
State-Changed-When: Wed Nov 8 03:45:43 UTC 2006 
State-Changed-Why:  
Bruce fixxored, I MFC'd. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104425 
>Unformatted:

Thanks, Bruce, will do.  Testing now.
