From nobody@FreeBSD.org  Fri Jun  6 02:30:40 2008
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 21DB4106567D
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Jun 2008 02:30:40 +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 0A2DD8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Jun 2008 02:30:40 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m562UdVw040595
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 6 Jun 2008 02:30:39 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m562UduG040594;
	Fri, 6 Jun 2008 02:30:39 GMT
	(envelope-from nobody)
Message-Id: <200806060230.m562UduG040594@www.freebsd.org>
Date: Fri, 6 Jun 2008 02:30:39 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: lib/libc/glob.c fails to compile under -CURRENT with default warning commentary and custom CFLAGs 
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         124334
>Category:       kern
>Synopsis:       [libc] [patch] lib/libc/glob.c fails to compile under -CURRENT with default warning commentary and custom CFLAGs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    mtm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 06 02:40:03 UTC 2008
>Closed-Date:    Fri Mar 15 23:42:07 UTC 2013
>Last-Modified:  Fri Mar 15 23:42:07 UTC 2013
>Originator:     Garrett Cooper
>Release:        8-CURRENT
>Organization:
>Environment:
FreeBSD optimus 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Mon May 19 02:21:07 PDT 2008     root@optimus:/usr/obj/usr/src/sys/OPTIMUS  i386

>Description:
libc always complains and dies after I cvs sync my srcs, until I apply the following change to correct the types that get passed into g_strchr and globexp2. 

Please see the following patch for more details..

# Helpful portions of make.conf

CFLAGS=-O3 -pipe -fno-strict-aliasing
CPUTYPE=prescott

This issue exists in 7.x as well, pending Warner Losh's changes to the code in revision 1.26 of the file.
>How-To-Repeat:
1. Checkout latest sources from CVS
2. make buildworld "CFLAGS=-O3 -pipe -fno-strict-aliasing" CPUTYPE=prescott
>Fix:
See attached patch.

Patch attached with submission follows:

Index: lib/libc/gen/glob.c
===================================================================
RCS file: /home/ncvs/src/lib/libc/gen/glob.c,v
retrieving revision 1.26
diff -r1.26 glob.c
242c242
< 	const Char* ptr = pattern;
---
> 	Char* ptr = (Char*) pattern;
249,250c249,250
< 	while ((ptr = (const Char *) g_strchr((Char *) ptr, LBRACE)) != NULL)
< 		if (!globexp2(ptr, pattern, pglob, &rv, limit))
---
> 	while ((ptr = (Char *) g_strchr(ptr, LBRACE)) != NULL)
> 		if (!globexp2((const Char*) ptr, pattern, pglob, &rv, limit))


>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/124334: commit references a PR
Date: Thu, 26 Jun 2008 07:12:57 +0000 (UTC)

 mtm         2008-06-26 07:12:35 UTC
 
   FreeBSD src repository
 
   Modified files:
     lib/libc/gen         glob.c 
   Log:
   SVN rev 180021 on 2008-06-26 07:12:35Z by mtm
   
   Gcc barfs in glob.c when run with -O3. To fix this make g_strchr() work on
   and return (const Char *) pointers instead of just (Char *) and get rid of
   all the type casting.
   
   PR:             kern/124334
   
   Revision  Changes    Path
   1.27      +5 -5      src/lib/libc/gen/glob.c
 _______________________________________________
 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->patched 
State-Changed-By: mtm 
State-Changed-When: Fri Jun 27 09:29:51 UTC 2008 
State-Changed-Why:  
Patched in head. Take the PR as a reminder to MFC. 


Responsible-Changed-From-To: freebsd-bugs->mtm 
Responsible-Changed-By: mtm 
Responsible-Changed-When: Fri Jun 27 09:29:51 UTC 2008 
Responsible-Changed-Why:  
Patched in head. Take the PR as a reminder to MFC. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=124334 
State-Changed-From-To: patched->closed 
State-Changed-By: eadler 
State-Changed-When: Fri Mar 15 23:42:07 UTC 2013 
State-Changed-Why:  
MFCed/fixed by now or it will never be MFCed 

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