NetBSD Problem Report #53137

From kre@munnari.OZ.AU  Tue Mar 27 23:12:02 2018
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 9DABD7A177
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 27 Mar 2018 23:12:02 +0000 (UTC)
Message-Id: <201803272310.w2RNArGV009789@jinx.noi.kre.to>
Date: Wed, 28 Mar 2018 06:10:53 +0700 (+07)
From: kre@munnari.OZ.AU
To: gnats-bugs@NetBSD.org
Subject: Non-deterministic gcc build (build fails sometimes)
X-Send-Pr-Version: 3.95

>Number:         53137
>Notify-List:    gson@gson.org
>Category:       toolchain
>Synopsis:       Non-deterministic gcc build (build fails sometimes)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    mrg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 27 23:15:00 +0000 2018
>Closed-Date:    Sat May 05 06:56:09 +0000 2018
>Last-Modified:  Sat May 05 06:56:09 +0000 2018
>Originator:     Robert Elz
>Release:        NetBSD 8.99.12 (and before, and after, up to current, today)
>Organization:
>Environment:


System: NetBSD jinx.noi.kre.to 8.99.12 NetBSD 8.99.12 (GENERIC) #1: Fri Feb 9 17:26:48 ICT 2018 kre@onyx.coe.psu.ac.th:/usr/obj/testing/amd64/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	The gcc build in current sometimes fails.   The problem can
	be observed in thes babylon5 test builds (and probably others):

		2018.02.20.12.49.40
		2018.02.23.19.39.27
		2018.03.02.14.45.23
		2018.03.06.11.21.31
		2018.03.07.20.43.53
		2018.03.17.18.22.23
		2018.03.27.07.29.44

	To look at the (end of) the build logs for those, use
  http://releng.netbsd.org/b5reports/i386/2018/<build-date>/build.log.tail
	where "<build-date>" is one of those above.

	For the last of those (2018.03.27.07.29.44), the "commits since
	the last successful build" were ...

    2018.03.27.06.16.34 roy src/external/bsd/dhcpcd/dist/src/dhcp.c,v 1.9
    2018.03.27.06.16.34 roy src/external/bsd/dhcpcd/dist/src/dhcpcd.c,v 1.9
    2018.03.27.06.18.40 roy src/external/bsd/dhcpcd/include/config.h,v 1.3
    2018.03.27.06.34.25 roy src/doc/3RDPARTY,v 1.1507
    2018.03.27.06.34.25 roy src/doc/CHANGES,v 1.2368
    2018.03.27.07.29.43 pgoyette src/sys/compat/common/Attic/compat_40_mod.c,v 1.1
    2018.03.27.07.29.44 pgoyette src/sys/compat/common/Attic/sysmon_power_40.c,v 1.1
    2018.03.27.07.29.44 pgoyette src/sys/modules/compat_40/Attic/Makefile,v 1.1

	And no, none of those should have any effect on gcc builds, and
	they are nothing like related to commits before the earlier
	failures, which also seem just as unrelated.

	I once thought that previous build failures may have contrinbuted in
	some way, but here (and one or two other cases) there was no
	recent previous build failure, so that seems to be unrelated.

	The most recent problem was "fixed" by:

    2018.03.27.11.59.49 martin src/lib/libm/src/s_scalbn.c,v 1.19

	Just as unlikely to be related.  As are the commits that
	"fixed" the previous cases.    This failure rarely occurs
	in successive builds.

	The build failures all seem to end up being because of apparently
	nonsense code in generated intermediate files.  E.g. from some of
	the above failures:

/tmp/bracket/build/2018.03.02.14.45.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/i386.md: In function 'int insn_default_latency_athlon(rtx_insn*)':
/tmp/bracket/build/2018.03.02.14.45.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/i386.md:24745:32: error: 'TY' was not declared in this scope
/tmp/bracket/build/2018.03.02.14.45.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/i386.md:24745:32: error: expected ')' at end of input
/tmp/bracket/build/2018.03.02.14.45.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/i386.md:24745:32: error: expected ')' at end of input
/tmp/bracket/build/2018.03.02.14.45.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/i386.md:24745:32: error: expected statement at end of input
/tmp/bracket/build/2018.03.02.14.45.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/i386.md:24745:32: error: expected '}' at end of input
/tmp/bracket/build/2018.03.02.14.45.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/i386.md:24745:32: error: expected '}' at end of input
/tmp/bracket/build/2018.03.02.14.45.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/i386.md:24745:32: error: control reaches end of non-void function [-Werror=return-type]

/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md: In function 'int insn_default_latency_znver1(rtx_insn*)':
/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24127:47: error: expected primary-expression at end of input
/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24127:47: error: expected ')' at end of input
/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24127:47: error: expected ')' at end of input
/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24127:47: error: expected ')' at end of input
/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24127:47: error: expected statement at end of input
/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24127:47: error: expected '}' at end of input
/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24127:47: error: expected '}' at end of input
/tmp/bracket/build/2018.03.06.11.21.31-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24127:47: error: control reaches end of non-void function [-Werror=return-type]

/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md: In function 'int internal_dfa_insn_code_bdver4(rtx_insn*)':
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: 're' was not declared in this scope
   [(set (match_operand:V4SI 0 "register_operand" "=Yr,*v")
                                                                                                                ^ 
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: expected ')' at end of input
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: expected ')' at end of input
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: expected ')' at end of input
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: expected ')' at end of input
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: expected statement at end of input
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: expected '}' at end of input
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: expected '}' at end of input
/tmp/bracket/build/2018.03.17.18.22.23-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:15010:112: error: control reaches end of non-void function [-Werror=return-type]
   [(set (match_operand:V4SI 0 "register_operand" "=Yr,*v")
                                                                                                                ^ 

/tmp/bracket/build/2018.03.27.07.29.44-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24543:80: error: expected '}' at end of input
/tmp/bracket/build/2018.03.27.07.29.44-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24543:80: error: expected '}' at end of input
/tmp/bracket/build/2018.03.27.07.29.44-i386/src/external/gpl3/gcc/dist/gcc/config/i386/sse.md:24543:80: error: control reaches end of non-void function [-Werror=return-type]

	Note that while sse.md seems over-represented as the file
	which fails to build, it is not always that one.   Also that
	the actual corruption is different in every case.  However
	"control reaches end of non-void function" seems to be common.
	(Or perhaps that is just because that was noticed, and is what
	the logs were searched for, meaning other similar failures which
	did not include this were missed - that is unknown.)

>How-To-Repeat:
	Unknown, it seems to be non-deterministic.

	I do mostly -j1 (more correctly, no -j option at all) builds
	for my setup, and have never seen this, so I would guess it
	is perhaps related.   So, starting with a large -j value and
	seeing what happens (after several clean builds) is probably
	where to start.

>Fix:
	?

>Release-Note:

>Audit-Trail:
From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: toolchain/53137: Non-deterministic gcc build (build fails sometimes)
Date: Wed, 28 Mar 2018 11:08:13 +1100

 i think this is caused by this rule:

 usr.bin/backend/Makefile:

 # genattrtab has three output files
 # XXX fix me
 insn-attrtab.c insn-dfatab.c insn-latencytab.c: genattrtab ${G_md_file} in=
 sn-conditions.md
 	${_MKTARGET_CREATE}
 	./genattrtab ${G_md_file} insn-conditions.md -Ainsn-attrtab.c -Dinsn-dfat=
 ab.c -Linsn-latencytab.c
 CLEANFILES+=3D    insn-attrtab.c insn-dfatab.c insn-latencytab.c

 just judging by what file fails most(all?) of the time.


 .mrg.

From: Robert Elz <kre@munnari.OZ.AU>
To: matthew green <mrg@eterna.com.au>
Cc: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org,
        gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: toolchain/53137: Non-deterministic gcc build (build fails sometimes)
Date: Wed, 28 Mar 2018 07:39:45 +0700

     Date:        Wed, 28 Mar 2018 11:08:13 +1100
     From:        matthew green <mrg@eterna.com.au>
     Message-ID:  <17891.1522195693@splode.eterna.com.au>

   | i think this is caused by this rule:

 It very well could be.   All the failures I have seen are in files that
 could be related to that - all seem related to instruction generation,
 and are reported as xxx.md file names (though that may come from
 #file or something in the actual file being processed.)

 Assuming that is it, how should the
 	# XXX fix me
 be done properly?

 kre

From: matthew green <mrg@eterna.com.au>
To: Robert Elz <kre@munnari.OZ.AU>
Cc: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org,
    gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: re: toolchain/53137: Non-deterministic gcc build (build fails sometimes)
Date: Wed, 28 Mar 2018 16:40:59 +1100

 Robert Elz writes:
 >     Date:        Wed, 28 Mar 2018 11:08:13 +1100
 >     From:        matthew green <mrg@eterna.com.au>
 >     Message-ID:  <17891.1522195693@splode.eterna.com.au>
 > =

 >   | i think this is caused by this rule:
 > =

 > It very well could be.   All the failures I have seen are in files that
 > could be related to that - all seem related to instruction generation,
 > and are reported as xxx.md file names (though that may come from
 > #file or something in the actual file being processed.)
 > =

 > Assuming that is it, how should the
 > 	# XXX fix me
 > be done properly?

 i've been using this patch, seems to work though i couldn't reproduce
 the issue myself.  i *think* it uses well defined semantics, it would
 be nice if others would confirm.

 this needs to be applied to gcc.old, and netbsd-7/8 too.  netbsd-6's
 GCC has no >1 output generators.


 .mrg.

 Index: external/gpl3/gcc/usr.bin/backend/Makefile
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvsroot/src/external/gpl3/gcc/usr.bin/backend/Makefile,v
 retrieving revision 1.43
 diff -p -u -r1.43 Makefile
 --- external/gpl3/gcc/usr.bin/backend/Makefile	11 Feb 2018 02:12:28 -0000	=
 1.43
 +++ external/gpl3/gcc/usr.bin/backend/Makefile	28 Mar 2018 05:38:11 -0000
 @@ -398,16 +398,23 @@ CLEANFILES+=3D	tree-check.h
  BUILDSYMLINKS+=3D insn-check.h tree-check.h
  =

  # genattrtab has three output files
 -# XXX fix me
 -insn-attrtab.c insn-dfatab.c insn-latencytab.c: genattrtab ${G_md_file} i=
 nsn-conditions.md =

 +insn-dfatab.c insn-latencytab.c: insn-attrtab.c
 +	cp -p ${.TARGET}.tmp ${.TARGET}
 +insn-attrtab.c: genattrtab ${G_md_file} insn-conditions.md =

  	${_MKTARGET_CREATE}
 -	./genattrtab ${G_md_file} insn-conditions.md -Ainsn-attrtab.c -Dinsn-dfa=
 tab.c -Linsn-latencytab.c
 +	./genattrtab ${G_md_file} insn-conditions.md \
 +		-A${.TARGET}.tmp -Dinsn-dfatab.c.tmp -Linsn-latencytab.c.tmp && \
 +	mv ${.TARGET}.tmp ${.TARGET}
  CLEANFILES+=3D	insn-attrtab.c insn-dfatab.c insn-latencytab.c
  =

  # genopinit has two output files
 -insn-opinit.c insn-opinit.h: genopinit ${G_md_file} insn-conditions.md
 +insn-opinit.h: insn-opinit.c
 +	cp -p ${.TARGET}.tmp ${.TARGET}
 +insn-opinit.c: genopinit ${G_md_file} insn-conditions.md
  	${_MKTARGET_CREATE}
 -	./genopinit ${G_md_file} insn-conditions.md -hinsn-opinit.h -cinsn-opini=
 t.c
 +	./genopinit ${G_md_file} insn-conditions.md \
 +		-hinsn-opinit.h.tmp -c${.TARGET}.tmp && \
 +	mv ${.TARGET}.tmp ${.TARGET}
  CLEANFILES+=3D	insn-opinit.h insn-opinit.c
  =

  LDFLAGS.genautomata+=3D	-lm

From: "matthew green" <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53137 CVS commit: src/external/gpl3/gcc/usr.bin/backend
Date: Mon, 2 Apr 2018 22:34:22 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Mon Apr  2 22:34:22 UTC 2018

 Modified Files:
 	src/external/gpl3/gcc/usr.bin/backend: Makefile

 Log Message:
 handle programs that have 3 outputs in a saner fashion.
 hopefully fixes PR 53137.


 To generate a diff of this commit:
 cvs rdiff -u -r1.43 -r1.44 src/external/gpl3/gcc/usr.bin/backend/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/53137: Non-deterministic gcc build (build fails
 sometimes)
Date: Wed, 4 Apr 2018 06:24:14 +0000

 On Wed, Mar 28, 2018 at 12:45:01AM +0000, Robert Elz wrote:
  >  Assuming that is it, how should the
  >  	# XXX fix me
  >  be done properly?

 You more or less can't. I did have a proposal for fixing
 multiple-output rules in bmake at one point but I can't remember what
 happened with it.

 -- 
 David A. Holland
 dholland@netbsd.org

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org, toolchain-manager@netbsd.org,
    gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    Robert Elz <kre@munnari.OZ.AU>
Cc: 
Subject: re: toolchain/53137: Non-deterministic gcc build (build fails sometimes)
Date: Thu, 05 Apr 2018 15:38:45 +1000

 matthew green writes:
 > 
 > i've been using this patch, seems to work though i couldn't reproduce
 > the issue myself.  i *think* it uses well defined semantics, it would
 > be nice if others would confirm.
 > 
 > this needs to be applied to gcc.old, and netbsd-7/8 too.  netbsd-6's
 > GCC has no >1 output generators.

 there was another build failure since my change, and then i saw the
 failure myself just now.  i think the problem is that insn-opinit.h
 is included by files many many files.  the previous fix i'm fairly
 sure is a valid and good change, but it didn't fix the problem here,
 which should be fixable by this:

 +DPSRCS+= insn-opinit.h

 in backend/Makefile.

 i'll commit this when my build works (i don't expect to reproduce it
 again easily.)


 .mrg.

From: "matthew green" <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53137 CVS commit: src/external/gpl3/gcc/usr.bin/backend
Date: Thu, 5 Apr 2018 05:38:59 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Thu Apr  5 05:38:59 UTC 2018

 Modified Files:
 	src/external/gpl3/gcc/usr.bin/backend: Makefile

 Log Message:
 pretty much everything depends upon insn-opinit.h via optabs-query.h
 so set it in DPSRCS.  hopefully this fixes PR 53137.


 To generate a diff of this commit:
 cvs rdiff -u -r1.45 -r1.46 src/external/gpl3/gcc/usr.bin/backend/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "matthew green" <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53137 CVS commit: src/external/gpl3/gcc/usr.bin/backend
Date: Thu, 12 Apr 2018 20:44:16 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Thu Apr 12 20:44:16 UTC 2018

 Modified Files:
 	src/external/gpl3/gcc/usr.bin/backend: Makefile

 Log Message:
 fix the hard coded depends list for insn-*.  i pulled these out
 of the generated .d files for a successful build.  i've tested
 that at least one recent macppc build failure is fixed with this
 change (namely, try building just insn-emit.o in this subdir),
 but the pattern should fix anything else left in insn*.

 this really should finally fix PR#53137.


 To generate a diff of this commit:
 cvs rdiff -u -r1.46 -r1.47 src/external/gpl3/gcc/usr.bin/backend/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: toolchain-manager->mrg
Responsible-Changed-By: mrg@NetBSD.org
Responsible-Changed-When: Thu, 12 Apr 2018 21:44:49 +0000
Responsible-Changed-Why:
i've been looking at this.


State-Changed-From-To: open->feedback
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Thu, 12 Apr 2018 21:44:49 +0000
State-Changed-Why:
i *really* think i've fixed it now.  :-)  please report if there
are further instances.  thanks!


From: "matthew green" <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53137 CVS commit: src/external/gpl3/gcc/usr.bin/backend
Date: Fri, 13 Apr 2018 01:14:19 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Fri Apr 13 01:14:19 UTC 2018

 Modified Files:
 	src/external/gpl3/gcc/usr.bin/backend: Makefile

 Log Message:
 fix some more missing depends issues.  remove various wrong/old depends.

 fixes issues i was able to trigger manually by building specific files.

 more for PR#53137.


 To generate a diff of this commit:
 cvs rdiff -u -r1.47 -r1.48 src/external/gpl3/gcc/usr.bin/backend/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: gson@gson.org
Subject: Re: toolchain/53137 (Non-deterministic gcc build (build fails sometimes))
Date: Fri, 13 Apr 2018 13:50:54 +0700

 Let's just leave this in feedback state until at least the end of the month,
 and see if we get any more issues, then (or perhaps a bit later) we can
 close it if nothing has happened.

 Thanks for all the effort on this Matthew.

 kre

State-Changed-From-To: feedback->closed
State-Changed-By: kre@NetBSD.org
State-Changed-When: Sat, 05 May 2018 06:56:09 +0000
State-Changed-Why:
We have not seen this since mrg committed the fix in mid April.
I'm happy to consider the problem solved - of course, should it
happen again, the PR can always be re-opened.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.