NetBSD Problem Report #53176

From martin@NetBSD.org  Thu Apr 12 16:21:44 2018
Return-Path: <martin@NetBSD.org>
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 11B307A187
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 12 Apr 2018 16:21:44 +0000 (UTC)
Message-Id: <20180412162132.92FDC5CC770@emmas.aprisoft.de>
Date: Thu, 12 Apr 2018 18:21:32 +0200 (CEST)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: 6.4 gcc fails to compile VAX kernels
X-Send-Pr-Version: 3.95

>Number:         53176
>Category:       toolchain
>Synopsis:       6.4 gcc fails to compile VAX kernels
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 12 16:25:00 +0000 2018
>Closed-Date:    Tue Oct 01 19:42:05 +0000 2019
>Last-Modified:  Tue Oct 01 19:42:05 +0000 2019
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.14
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD seven-days-to-the-wolves.aprisoft.de 8.99.14 NetBSD 8.99.14 (GENERIC) #205: Mon Mar 26 16:49:32 CEST 2018 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

Trying to cross-build a vax kernel with latest -current
fails for me reproducably. Gcc is:

 > /work/tools/bin/vax--netbsdelf-gcc -v
Using built-in specs.
COLLECT_GCC=/work/tools/bin/vax--netbsdelf-gcc
COLLECT_LTO_WRAPPER=/work/tools/libexec/gcc/vax--netbsdelf/6.4.0/lto-wrapper
Target: vax--netbsdelf
Configured with: /work/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=vax--netbsdelf --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb2 20180327' --with-system-zlib --disable-libstdcxx-dual-abi --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-sysroot=/work/hosts/vax --with-mpc=/work/tools --with-mpfr=/work/tools --with-gmp=/work/tools --disable-nls --disable-multilib --program-transform-name=s,^,vax--netbsdelf-, --enable-languages='c c++ objc' --prefix=/work/tools
Thread model: posix
gcc version 6.4.0 (NetBSD nb2 20180327) 


I am using a stripped down kernel config, with makeoptions DEBUG="-g".

#   compile  DEAD/ip_icmp.o
/work/tools/bin/vax--netbsdelf-gcc -pipe -fno-pic -ffreestanding -fno-zero-initialized-in-bss -fno-delete-null-pointer-checks -g -O2 -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes -Wno-sign-compare --sysroot=/work/hosts/vax -D_VAX_INLINE_ -I. -I../../../../../common/lib/libx86emu -I../../../../../common/include -I../../../../arch -I../../../.. -nostdinc -DDIAGNOSTIC -DP1003_1B_SEMAPHORE -D_KERNEL -D_KERNEL_OPT -std=gnu99 -I../../../../lib/libkern/../../../common/lib/libc/quad -I../../../../lib/libkern/../../../common/lib/libc/string -I../../../../lib/libkern/../../../common/lib/libc/arch/vax/string -c ../../../../netinet/ip_icmp.c -o ip_icmp.o
../../../../netinet/ip_icmp.c: In function 'icmp_reflect':
../../../../netinet/ip_icmp.c:983:1: internal compiler error: Segmentation fault
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.NetBSD.org/Misc/send-pr.html> for instructions.

*** Failed target:  ip_icmp.o
*** Failed command: echo '# ' "compile DEAD/ip_icmp.o" && echo /work/tools/bin/vax--netbsdelf-gcc -pipe -fno-pic -ffreestanding -fno-zero-initialized-in-bss -fno-delete-null-pointer-checks -g -O2 -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes -Wno-sign-compare --sysroot=/work/hosts/vax -D_VAX_INLINE_ -I. -I../../../../../common/lib/libx86emu -I../../../../../common/include -I../../../../arch -I../../../.. -nostdinc -DDIAGNOSTIC -DP1003_1B_SEMAPHORE -D_KERNEL -D_KERNEL_OPT -std=gnu99 -I../../../../lib/libkern/../../../common/lib/libc/quad -I../../../../lib/libkern/../../../common/lib/libc/string -I../../../../lib/libkern/../../../common/lib/libc/arch/vax/string -c ../../../../netinet/ip_icmp.c -o ip_icmp.o && /work/tools/bin/vax--netbsdelf-gcc -pipe -fno-pic -ff
 reestanding -fno-zero-initialized-in-bss -fno-delete-null-pointer-checks -g -O2 -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes -Wno-sign-compare --sysroot=/work/hosts/vax -D_VAX_INLINE_ -I. -I../../../../../common/lib/libx86emu -I../../../../../common/include -I../../../../arch -I../../../.. -nostdinc -DDIAGNOSTIC -DP1003_1B_SEMAPHORE -D_KERNEL -D_KERNEL_OPT -std=gnu99 -I../../../../lib/libkern/../../../common/lib/libc/quad -I../../../../lib/libkern/../../../common/lib/libc/string -I../../../../lib/libkern/../../../common/lib/libc/arch/vax/string -c ../../../../netinet/ip_icmp.c -o ip_icmp.o && :
*** Error code 1

Stop.
nbmake: stopped in /work/src/sys/arch/vax/compile/DEAD


>How-To-Repeat:
s/a

>Fix:
n/a

>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/53176: 6.4 gcc fails to compile VAX kernels
Date: Fri, 13 Apr 2018 11:30:14 +1000

 i am unable to reproduce this on a netbsd-8 amd64 host.

 i wonder if it is a bug in gcc6 compiled vax-gcc6.


 .mrg.

From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/53176: 6.4 gcc fails to compile VAX kernels
Date: Fri, 13 Apr 2018 05:03:32 +0000

 Please re-run the failing gcc command with -save-temps and save the
 result & flags used

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/53176: 6.4 gcc fails to compile VAX kernels
Date: Fri, 13 Apr 2018 07:50:19 +0200

 The command invoked is:

  /work/tools/libexec/gcc/vax--netbsdelf/6.4.0/cc1 -fpreprocessed ip_icmp.i -quiet -dumpbase ip_icmp.c -auxbase-strip ip_icmp.o -g -O2 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-pointer-sign -Wno-attributes -Wno-sign-compare -std=gnu99 -std=gnu99 -version -fno-pic -ffreestanding -fno-zero-initialized-in-bss -fno-delete-null-pointer-checks -fno-strict-aliasing -fno-common -o ip_icmp.s

 and gdb says:

 Program received signal SIGSEGV, Segmentation fault.
 0x0000000000789457 in allocno_copy_cost_saving(ira_allocno*, int) ()
 (gdb) bt
 #0  0x0000000000789457 in allocno_copy_cost_saving(ira_allocno*, int) ()
 #1  0x00000000007912e9 in color_pass(ira_loop_tree_node*) ()
 #2  0x0000000000780c38 in ira_traverse_loop_tree(bool, ira_loop_tree_node*, void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*)) ()
 #3  0x000000000078e62e in ira_color() ()
 #4  0x000000000077a8cd in (anonymous namespace)::pass_ira::execute(function*) ()
 #5  0x000000000082899a in execute_one_pass(opt_pass*) ()
 #6  0x0000000000828f02 in execute_pass_list_1(opt_pass*) ()
 #7  0x0000000000828f14 in execute_pass_list_1(opt_pass*) ()
 #8  0x0000000000828f2d in execute_pass_list(function*, opt_pass*) ()
 #9  0x0000000000606bdb in cgraph_node::expand() ()
 #10 0x0000000000608102 in symbol_table::compile() ()
 #11 0x000000000060979f in symbol_table::finalize_compilation_unit() ()
 #12 0x00000000008a1c8c in compile_file() ()
 #13 0x00000000008a383d in toplev::main(int, char**) ()
 #14 0x0000000000c2a243 in main ()

 and the input file is at: http://www.netbsd.org/~martin/ip_icmp.i.bz2

 Martin

From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/53176: 6.4 gcc fails to compile VAX kernels
Date: Fri, 13 Apr 2018 18:16:04 +0000

 Fails in cross from amd64 too.

 Program received signal SIGSEGV, Segmentation fault.
 0x00000000009fa7be in allocno_copy_cost_saving (allocno=0x7e215b4c9178, hard_regno=6) at /current/src/tools/gcc/../../external/gpl3/gcc/dist/gcc/ira-color.c:2763
 2763	      cost += cp->freq * ira_register_move_cost[allocno_mode][rclass][rclass];
 1: allocno_mode = QImode
 2: rclass = ALL_REGS
 3: ira_register_move_cost[allocno_mode][rclass][rclass] = <error: Cannot access memory at address 0x6>
 4: cp->freq = 4

From: coypu@sdf.org
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/53176: 6.4 gcc fails to compile VAX kernels
Date: Sat, 14 Apr 2018 09:05:50 +0000

 I bisected it to this commit

 commit bbb9b536dd58015b5712a867954d34aae9d9dae5 (HEAD, refs/bisect/bad)
 Author: thopre01 <thopre01@138bc75d-0d04-0410-961f-82ee72b054a4>
 Date:   Tue Jan 6 11:51:16 2015 +0000

     2015-01-06  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         gcc/
         PR tree-optimization/63259
         * tree-ssa-math-opts.c (pass_optimize_bswap::execute): Stop checking
         if optab exists for 16bit byteswap.

     git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219256 138bc75d-0d04-0410-961f-82ee72b054a4

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: mrg@NetBSD.org, kristerw@NetBSD.org
Subject: Re: toolchain/53176: 6.4 gcc fails to compile VAX kernels
Date: Sun, 22 Apr 2018 13:17:20 +0200

 The difference that kills it (vs GENERIC) is options DIAGNOSTIC.

 If you uncomment that in vax/conf/GENERIC that kernel fails with the same
 error.

 Can we switch back to 5.4 untill this is fixed? Krister, there is
 an upstream bug report, any chance to have a look?
 [Bug target/85401] segfault building code for VAX

 Martin

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53176 CVS commit: src/external/gpl3
Date: Mon, 29 Oct 2018 10:22:57 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Oct 29 10:22:57 UTC 2018

 Modified Files:
 	src/external/gpl3/gcc.old/dist/gcc: ira-color.c
 	src/external/gpl3/gcc/dist/gcc: ira-color.c

 Log Message:
 VAX does not fully populate the register move costs table, so do not
 access it w/o checks.
 Hack to work around PR toolchain/53176.


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gcc.old/dist/gcc/ira-color.c
 cvs rdiff -u -r1.1.1.4 -r1.2 src/external/gpl3/gcc/dist/gcc/ira-color.c

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

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53176 CVS commit: src/external/gpl3/gcc/dist/gcc
Date: Sat, 14 Sep 2019 15:00:05 +0000

 Module Name:	src
 Committed By:	maya
 Date:		Sat Sep 14 15:00:05 UTC 2019

 Modified Files:
 	src/external/gpl3/gcc/dist/gcc: ira-color.c

 Log Message:
 Revert ira-color.c r1.2.

 "VAX does not fully populate the register move costs table, so do not
 access it w/o checks.
 Hack to work around PR toolchain/53176."

 Will commit a more upstream-friendly variant shortly.


 To generate a diff of this commit:
 cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc/dist/gcc/ira-color.c

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

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/53176 CVS commit: src/external/gpl3/gcc/dist/gcc
Date: Sat, 14 Sep 2019 15:02:47 +0000

 Module Name:	src
 Committed By:	maya
 Date:		Sat Sep 14 15:02:47 UTC 2019

 Modified Files:
 	src/external/gpl3/gcc/dist/gcc: ira-color.c

 Log Message:
 Initialize the mode before accessing the move costs.
 This matches the code of the rest of the file, and might be acceptable
 by upstream.

 PR toolchain/53176.


 To generate a diff of this commit:
 cvs rdiff -u -r1.4 -r1.5 src/external/gpl3/gcc/dist/gcc/ira-color.c

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

State-Changed-From-To: open->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 01 Oct 2019 19:42:05 +0000
State-Changed-Why:
officially not a hack as upstream accepted the fix :-)


>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.