From nobody@FreeBSD.org  Mon Oct  1 13:49:13 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 1C43E1065672
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  1 Oct 2012 13:49:13 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id E267C8FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  1 Oct 2012 13:49:12 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q91DnC9t031893
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 1 Oct 2012 13:49:12 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id q91DnCwd031892;
	Mon, 1 Oct 2012 13:49:12 GMT
	(envelope-from nobody)
Message-Id: <201210011349.q91DnCwd031892@red.freebsd.org>
Date: Mon, 1 Oct 2012 13:49:12 GMT
From: Miklos Magyari <magyarimiki@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: devel/avr-gbd fails to build using clang
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         172209
>Category:       ports
>Synopsis:       devel/avr-gdb fails to build using clang
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    joerg
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 01 13:50:01 UTC 2012
>Closed-Date:    Fri Oct 18 12:00:36 CEST 2013
>Last-Modified:  Fri Oct 18 12:00:36 CEST 2013
>Originator:     Miklos Magyari
>Release:        9.0-RELEASE
>Organization:
>Environment:
FreeBSD mira 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
devel/avr-gbd fails to build using clang:

[...snip...]

/bin/sh ./libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H -I. -I. -I. -I./../include  -DHAVE_bfd_elf32_avr_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec  -DBINDIR='"/usr/local/bin"'  -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -O2 -pipe -fno-strict-aliasing -MT bfdio.lo -MD -MP -MF .deps/bfdio.Tpo -c -o bfdio.lo bfdio.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I. -I. -I./../include -DHAVE_bfd_elf32_avr_vec -DHAVE_bfd_elf32_little_generic_vec -DHAVE_bfd_elf32_big_generic_vec -DBINDIR=\"/usr/local/bin\" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -O2 -pipe -fno-strict-aliasing -MT bfdio.lo -MD -MP -MF .deps/bfdio.Tpo -c bfdio.c -o bfdio.o
bfdio.c:580:31: error: argument to 'sizeof' in 'memset' call is the same expression as the destination; did you mean to dereference it? [-Werror,-Wsizeof-pointer-memaccess]
  memset (statbuf, 0, sizeof (statbuf));
          ~~~~~~~             ^~~~~~~
1 error generated.
gmake[4]: *** [bfdio.lo] Error 1
gmake[4]: Leaving directory `/work/a/ports/devel/avr-gdb/work/gdb-7.3.1/bfd'
gmake[3]: *** [all-recursive] Error 1
gmake[3]: Leaving directory `/work/a/ports/devel/avr-gdb/work/gdb-7.3.1/bfd'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/work/a/ports/devel/avr-gdb/work/gdb-7.3.1/bfd'
gmake[1]: *** [all-bfd] Error 2
gmake[1]: Leaving directory `/work/a/ports/devel/avr-gdb/work/gdb-7.3.1'
gmake: *** [all] Error 2
*** Error code 1

Stop in /a/ports/devel/avr-gdb.
>How-To-Repeat:
# cd /usr/ports/devel/avr-gdb
# make
>Fix:
patch to the port Makefile:

--- Makefile.orig       2012-10-01 15:45:38.000000000 +0200
+++ Makefile    2012-10-01 15:26:38.000000000 +0200
@@ -22,6 +22,8 @@
 GNU_CONFIGURE= yes
 CONFIGURE_ARGS=        --target=avr --program-prefix=avr --disable-nls

+CFLAGS+=       -Wno-unused-value
+
 pre-configure:
        cd ${WRKSRC} ; ${RM} -rf dejagnu expect tcl texinfo


another patch in needed under files/ :

a# cat files/patch-bfd::bfdio.c
--- bfd/bfdio.c.orig    2012-10-01 15:32:52.000000000 +0200
+++ bfd/bfdio.c 2012-10-01 15:28:13.000000000 +0200
@@ -577,7 +577,7 @@
 {
   struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;

-  memset (statbuf, 0, sizeof (statbuf));
+  memset (statbuf, 0, sizeof (struct stat));
   statbuf->st_size = bim->size;

   return 0;



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->joerg 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Mon Oct 8 06:04:06 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/172209: commit references a PR
Date: Fri, 18 Oct 2013 09:59:51 +0000 (UTC)

 Author: tijl
 Date: Fri Oct 18 09:59:43 2013
 New Revision: 330734
 URL: http://svnweb.freebsd.org/changeset/ports/330734
 
 Log:
   Fix two bugs reported by clang.
   
   PR:		ports/172209
   Submitted by:	Miklos Magyari <magyarimiki@gmail.com>
   Approved by:	maintainer timeout (1 year)
 
 Added:
   head/devel/avr-gdb/files/patch-bfd-bfdio.c   (contents, props changed)
   head/devel/avr-gdb/files/patch-bfd-elflink.c   (contents, props changed)
 Modified:
   head/devel/avr-gdb/Makefile
 
 Modified: head/devel/avr-gdb/Makefile
 ==============================================================================
 --- head/devel/avr-gdb/Makefile	Fri Oct 18 09:56:47 2013	(r330733)
 +++ head/devel/avr-gdb/Makefile	Fri Oct 18 09:59:43 2013	(r330734)
 @@ -3,7 +3,7 @@
  
  PORTNAME=	gdb
  PORTVERSION=	7.3.1
 -PORTREVISION=	2
 +PORTREVISION=	3
  CATEGORIES=	devel
  MASTER_SITES=	${MASTER_SITE_GNU}
  MASTER_SITE_SUBDIR=	gdb
 
 Added: head/devel/avr-gdb/files/patch-bfd-bfdio.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/devel/avr-gdb/files/patch-bfd-bfdio.c	Fri Oct 18 09:59:43 2013	(r330734)
 @@ -0,0 +1,11 @@
 +--- bfd/bfdio.c.orig
 ++++ bfd/bfdio.c
 +@@ -577,7 +577,7 @@
 + {
 +   struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
 + 
 +-  memset (statbuf, 0, sizeof (statbuf));
 ++  memset (statbuf, 0, sizeof (*statbuf));
 +   statbuf->st_size = bim->size;
 + 
 +   return 0;
 
 Added: head/devel/avr-gdb/files/patch-bfd-elflink.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/devel/avr-gdb/files/patch-bfd-elflink.c	Fri Oct 18 09:59:43 2013	(r330734)
 @@ -0,0 +1,11 @@
 +--- bfd/elflink.c.orig
 ++++ bfd/elflink.c
 +@@ -12456,7 +12456,7 @@
 + 		   abfd, sec);
 + 	      else if (sec->size != 0)
 + 		{
 +-		  bfd_byte *sec_contents, *l_sec_contents;
 ++		  bfd_byte *sec_contents = NULL, *l_sec_contents = NULL;
 + 
 + 		  if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
 + 		    (*_bfd_error_handler)
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: tijl 
State-Changed-When: Fri Oct 18 12:00:03 CEST 2013 
State-Changed-Why:  
Committed in r330734. 

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