From nobody@FreeBSD.org  Tue May 18 20:12:44 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 44350106567A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 18 May 2010 20:12:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 32DA88FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 18 May 2010 20:12:44 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o4IKChuw078087
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 18 May 2010 20:12:43 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o4IKChgw078086;
	Tue, 18 May 2010 20:12:43 GMT
	(envelope-from nobody)
Message-Id: <201005182012.o4IKChgw078086@www.freebsd.org>
Date: Tue, 18 May 2010 20:12:43 GMT
From: Alexander <freebsd@nagilum.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: gcc CPU detection error
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         146716
>Category:       gnu
>Synopsis:       gcc(1) gcc CPU detection error
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    mm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 18 20:20:01 UTC 2010
>Closed-Date:    Mon Nov 07 11:12:21 UTC 2011
>Last-Modified:  Mon Nov 07 11:12:21 UTC 2011
>Originator:     Alexander
>Release:        FreeBSD 8.0-STABLE
>Organization:
>Environment:
FreeBSD cakebox.tis 8.0-STABLE FreeBSD 8.0-STABLE #0: Mon Mar  1 12:13:22 CET 2010     root@cakebox.tis:/usr/obj/export/src/sys/net5501  i386
>Description:
This is basically http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37179
$ gcc -march=native -### a16.c
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.1 20070719  [FreeBSD]
 "/usr/libexec/cc1" "-quiet" "-D_LONGLONG" "a16.c" "-march=athlon" "-mtune=athlon" "-quiet" "-dumpbase" "a16.c" "-auxbase" "a16" "-o" "/var/tmp//cc51kNdo.s"
 "/usr/bin/as" "-o" "/var/tmp//cc6UovRy.o" "/var/tmp//cc51kNdo.s"
 "/usr/bin/ld" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld-elf.so.1" "/usr/lib/crt1.o" "/usr/lib/crti.o" "/usr/lib/crtbegin.o" "-L/usr/lib" "-L/usr/lib" "/var/tmp//cc6UovRy.o" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" "/usr/lib/crtend.o" "/usr/lib/crtn.o"

vs:
$ gcc44 -march=native -### a16.c
Using built-in specs.
Target: i386-portbld-freebsd8.0
Configured with: ./../gcc-4.4-20100427/configure --disable-nls --libdir=/usr/local/lib/gcc44 --libexecdir=/usr/local/libexec/gcc44 --program-suffix=44 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc44/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-system-zlib --disable-rpath --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc44 --build=i386-portbld-freebsd8.0
Thread model: posix
gcc version 4.4.4 20100427 (prerelease) (GCC)
COLLECT_GCC_OPTIONS=
 "/usr/local/libexec/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/cc1" "-quiet" "a16.c" "-march=geode" "--param" "l1-cache-size=64" "--param" "l1-cache-line-size=32" "--param" "l2-cache-size=128" "-mtune=geode" "-quiet" "-dumpbase" "a16.c" "-auxbase" "a16" "-o" "/var/tmp//cct3VB2u.s"
COLLECT_GCC_OPTIONS=
 "/usr/local/bin/as" "-o" "/var/tmp//ccfjzqyD.o" "/var/tmp//cct3VB2u.s"
COMPILER_PATH=/usr/local/libexec/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/:/usr/local/libexec/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/:/usr/local/libexec/gcc44/gcc/i386-portbld-freebsd8.0/:/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/:/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/:/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/../../../../../i386-portbld-freebsd8.0/bin/
LIBRARY_PATH=/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/:/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/../../../../../i386-portbld-freebsd8.0/lib/:/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS=
 "/usr/local/libexec/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/collect2" "-dynamic-linker" "/libexec/ld-elf.so.1" "/usr/lib/crt1.o" "/usr/lib/crti.o" "/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/crtbegin.o" "-L/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4" "-L/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/../../../../../i386-portbld-freebsd8.0/lib" "-L/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/../../.." "/var/tmp//ccfjzqyD.o" "-lgcc" "-lgcc_eh" "-lc" "-lgcc" "-lgcc_eh" "/usr/local/lib/gcc44/gcc/i386-portbld-freebsd8.0/4.4.4/crtend.o" "/usr/lib/crtn.o"

nagilum@cakebox /var/run > head -12 dmesg.boot 
Copyright (c) 1992-2010 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 8.0-STABLE #0: Mon Mar  1 12:13:22 CET 2010
    root@cakebox.tis:/usr/obj/export/src/sys/net5501 i386
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Geode(TM) Integrated Processor by AMD PCS (499.90-MHz 586-class CPU)
  Origin = "AuthenticAMD"  Id = 0x5a2  Stepping = 2
  Features=0x88a93d<FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CLFLUSH,MMX>
  AMD Features=0xc0400000<MMX+,3DNow!+,3DNow!>
real memory  = 536870912 (512 MB)

>How-To-Repeat:
Compile code with -march=native on a Geode system, watch the resulting programs crash and die (no a Geode system).

>Fix:
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37179
As a workaround I'm using "-march=pentium -mtune=generic"

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon May 31 05:02:55 UTC 2010 
Responsible-Changed-Why:  
reclassify. 

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

From: Garrett Cooper <yanefbsd@gmail.com>
To: bug-followup@FreeBSD.org, freebsd@nagilum.org
Cc:  
Subject: Re: gnu/146716: gcc(1)] gcc CPU detection error
Date: Mon, 31 May 2010 16:11:08 -0700

     This isn't a problem with the base system version of the compiler
 though, so I would argue that it's not appropriately classified and/or
 filed; it should be noted as an issue upstream -- which it is --
 and/or potentially a ports bug warranting a gcc upgrade.
 Thanks,
 -Garrett

From: Alexander <freebsd@nagilum.org>
To: Garrett Cooper <yanefbsd@gmail.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: gnu/146716: gcc(1)] gcc CPU detection error
Date: Tue, 01 Jun 2010 08:39:48 +0200

 So this:
 /usr/bin/gcc --version
 gcc (GCC) 4.2.1 20070719  [FreeBSD]
 Copyright (C) 2007 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 is not from base??
 Are you sure about that?
 
 ----- Message from yanefbsd@gmail.com ---------
      Date: Mon, 31 May 2010 16:11:08 -0700
      From: Garrett Cooper <yanefbsd@gmail.com>
   Subject: Re: gnu/146716: gcc(1)] gcc CPU detection error
        To: bug-followup@FreeBSD.org, freebsd@nagilum.org
 
 
 >     This isn't a problem with the base system version of the compiler
 > though, so I would argue that it's not appropriately classified and/or
 > filed; it should be noted as an issue upstream -- which it is --
 > and/or potentially a ports bug warranting a gcc upgrade.
 > Thanks,
 > -Garrett
 >
 
 
 ----- End message from yanefbsd@gmail.com -----
 
 
 
 ========================================================================
 #    _  __          _ __     http://www.nagilum.org/ \n icq://69646724 #
 #   / |/ /__ ____ _(_) /_ ____ _  nagilum@nagilum.org \n +491776461165 #
 #  /    / _ `/ _ `/ / / // /  ' \  Amiga (68k/PPC): AOS/NetBSD/Linux   #
 # /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/ Mac (PPC): MacOS-X / Linux / MacOS-X #
 #           /___/     x86: FreeBSD/Linux/Solaris/Win2k  ARM9: EPOC EV6 #
 ========================================================================
 
 
 ----------------------------------------------------------------
 cakebox.homeunix.net - all the machine one needs..

From: Martin Matuska <mm@FreeBSD.org>
To: bug-followup@FreeBSD.org, freebsd@nagilum.org
Cc:  
Subject: Re: gnu/146716: gcc(1) gcc CPU detection error
Date: Mon, 07 Mar 2011 16:25:16 +0100

 Could you please test it again with latest HEAD (since r219376) or
 stable-8 with this patch:
 http://people.freebsd.org/~mm/patches/stable-8-gcc-core2-geode.patch
State-Changed-From-To: open->feedback 
State-Changed-By: arundel 
State-Changed-When: Tue Mar 8 20:44:25 UTC 2011 
State-Changed-Why:  
Please note that feedback has been requested. 

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

From: Alexander <freebsd@nagilum.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: gnu/146716: gcc(1) gcc CPU detection error
Date: Thu, 24 Mar 2011 22:23:20 +0100

 The generated code using -march=geode -mtune=geode works fine on Geode CPUs.
 The only thing missing is the CPU detection on Geode but
 otherwise it seems to work.
 
 nagilum@cakebox ~/Projects/C/src/a16 > gcc -### -march=native
 -mtune=native -O3 -o a16 a16.c
 Using built-in specs.
 Target: i386-undermydesk-freebsd
 Configured with: FreeBSD/i386 system compiler
 Thread model: posix
 gcc version 4.2.1 20070719  [FreeBSD]
   "/usr/libexec/cc1" "-quiet" "-D_LONGLONG" "a16.c" "-march=athlon"
 "-mtune=athlon" "-quiet" "-dumpbase" "a16.c" "-auxbase" "a16" "-O3" "-o"
 "/var/tmp//ccLq86VU.s"
   "/usr/bin/as" "-o" "/var/tmp//ccYpfGUH.o" "/var/tmp//ccLq86VU.s"
   "/usr/bin/ld" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld-elf.so.1"
 "-o" "a16" "/usr/lib/crt1.o" "/usr/lib/crti.o" "/usr/lib/crtbegin.o"
 "-L/usr/lib" "-L/usr/lib" "/var/tmp//ccYpfGUH.o" "-lgcc" "--as-needed"
 "-lgcc_s" "--no-as-needed" "-lc" "-lgcc" "--as-needed" "-lgcc_s"
 "--no-as-needed" "/usr/lib/crtend.o" "/usr/lib/crtn.o"
 
 
 ========================================================================
 #    _  __          _ __     http://www.nagilum.org/ \n icq://69646724 #
 #   / |/ /__ ____ _(_) /_ ____ _  nagilum@nagilum.org \n +491776461165 #
 #  /    / _ `/ _ `/ / / // /  ' \  Amiga (68k/PPC): AOS/NetBSD/Linux   #
 # /_/|_/\_,_/\_, /_/_/\_,_/_/_/_/ Mac (PPC): MacOS-X / Linux / MacOS-X #
 #           /___/     x86: FreeBSD/Linux/Solaris/Win2k  ARM9: EPOC EV6 #
 ========================================================================
 
 
 ----------------------------------------------------------------
 cakebox.homeunix.net - all the machine one needs..
State-Changed-From-To: feedback->patched 
State-Changed-By: arundel 
State-Changed-When: Sat Mar 26 18:38:31 UTC 2011 
State-Changed-Why:  
Fixed in HEAD (r219376). 


Responsible-Changed-From-To: freebsd-bugs->mm 
Responsible-Changed-By: arundel 
Responsible-Changed-When: Sat Mar 26 18:38:31 UTC 2011 
Responsible-Changed-Why:  
Over to committer as MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=146716 
State-Changed-From-To: patched->closed 
State-Changed-By: mm 
State-Changed-When: Mon Nov 7 11:12:18 UTC 2011 
State-Changed-Why:  
Resolved. Thanks! 

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