NetBSD Problem Report #48731

From wiz@yt.nih.at  Thu Apr 10 09:31:02 2014
Return-Path: <wiz@yt.nih.at>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 72669A5807
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 10 Apr 2014 09:31:02 +0000 (UTC)
Message-Id: <20140410090006.360932AC105@yt.nih.at>
Date: Thu, 10 Apr 2014 11:00:06 +0200 (CEST)
From: Thomas Klausner <wiz@NetBSD.org>
Reply-To: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Subject: internal compiler error (wip/gambatte; g++/bits/basic_string.tcc)
X-Send-Pr-Version: 3.95

>Number:         48731
>Category:       toolchain
>Synopsis:       internal compiler error (wip/gambatte; g++/bits/basic_string.tcc)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 10 09:35:00 +0000 2014
>Last-Modified:  Fri Apr 11 14:50:01 +0000 2014
>Originator:     Thomas Klausner
>Release:        NetBSD 6.99.40/20140408
>Organization:
Curiosity is the very basis of education and if you tell me that
curiosity killed the cat, I say only that the cat died nobly.
- Arnold Edinborough
>Environment:


System: NetBSD 6.99.40
Architecture: x86_64
Machine: amd64
>Description:
I've tried compiling wip/gambatte-dev. I've configured pkgsrc to use
clang, but in this case the package seems to use g++ anyway.

Building immediately stops with:

scons: Building targets ...
g++ -o src/cpu.o -c -Wall -Wextra -O2 -fomit-frame-pointer -fno-exceptions -fno-rtti -DHAVE_STDINT_H -Isrc -Iinclude -I/scratch/wip/gambatte-dev/work/gambatte_src-r550/common src/cpu.cpp
In file included from /usr/include/g++/string:53:0,
                 from include/loadres.h:4,
                 from src/mem/cartridge.h:22,
                 from src/memory.h:22,
                 from src/cpu.h:22,
                 from src/cpu.cpp:19:
/usr/include/g++/bits/basic_string.tcc:464:5: internal compiler error: Segmentation fault
     }
     ^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.NetBSD.org/Misc/send-pr.html> for instructions.
scons: *** [src/cpu.o] Error 1

I've looked with ktrace, it's cc1plus reporting that error (forked by
g++).

>How-To-Repeat:
cd /usr/pkgsrc/wip/gambatte-dev
make
>Fix:

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/48731: internal compiler error (wip/gambatte;
 g++/bits/basic_string.tcc)
Date: Thu, 10 Apr 2014 11:39:07 +0200

 On Thu, Apr 10, 2014 at 11:05:25AM +0200, Martin Husemann wrote:
 > You can re-invoke g++ manually and add -v to the command line, which
 > will make it print out the actually cc1plus invocation - which you
 > can then run inside gdb.

 (gdb) r -quiet -v -I src -I include -I /disk/3/archive/obj/wip/gambatte-dev/work.x86_64/gambatte_src-r550/common -D HAVE_STDINT_H src/cpu.cpp -quiet -dumpbase cpu.cpp -mtune=nocona -march=x86-64 -auxbase-strip sr
 c/cpu.o -O2 -Wall -Wextra -version -fomit-frame-pointer -fno-exceptions -fno-rtti -o /var/tmp//ccfIzQKQ.s
 Starting program: /usr/libexec/cc1plus -quiet -v -I src -I include -I /disk/3/archive/obj/wip/gambatte-dev/work.x86_64/gambatte_src-r550/common -D HAVE_STDINT_H src/cpu.cpp -quiet -dumpbase cpu.cpp -mtune=nocona 
 -march=x86-64 -auxbase-strip src/cpu.o -O2 -Wall -Wextra -version -fomit-frame-pointer -fno-exceptions -fno-rtti -o /var/tmp//ccfIzQKQ.s
 GNU C++ (NetBSD nb2 20140304) version 4.8.3 (x86_64--netbsd)
         compiled by GNU C version 4.2.1 Compatible Clang 3.5 (trunk 202566), GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 #include "..." search starts here:
 #include <...> search starts here:
  src  
  include
  /disk/3/archive/obj/wip/gambatte-dev/work.x86_64/gambatte_src-r550/common
  /usr/include/g++
  /usr/include/g++/backward
  /usr/include/gcc-4.8
  /usr/include
 End of search list.
 GNU C++ (NetBSD nb2 20140304) version 4.8.3 (x86_64--netbsd)
         compiled by GNU C version 4.2.1 Compatible Clang 3.5 (trunk 202566), GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 Compiler executable checksum: 4054f87540345d4e138a62067c6e8c30

 Program received signal SIGSEGV, Segmentation fault.
 0x00000000004f7670 in poplevel_class () at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/name-lookup.c:2860
 2860              IDENTIFIER_BINDING (cb->identifier) = cb->base->previous;
 (gdb) bt
 #0  0x00000000004f7670 in poplevel_class () at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/name-lookup.c:2860
 #1  0x0000000000459b9c in popclass () at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/class.c:6935
 #2  pop_nested_class () at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/class.c:7081
 #3  0x000000000042a934 in finish_function (flags=<optimized out>) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/decl.c:13991
 #4  0x000000000048d01a in cp_parser_function_definition_after_declarator (parser=0x7f7ff6035bb0, inline_p=false) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:21837
 #5  0x0000000000478f98 in cp_parser_function_definition_from_specifiers_and_declarator (parser=<optimized out>, decl_specifiers=<optimized out>, attributes=<optimized out>, declarator=<optimized out>)
     at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:21752
 #6  cp_parser_init_declarator (parser=0x7f7ff6035bb0, decl_specifiers=<optimized out>, checks=<optimized out>, function_definition_allowed_p=<optimized out>, member_p=<optimized out>, 
     declares_class_or_enum=<optimized out>, function_definition_p=<optimized out>, maybe_range_for_decl=<optimized out>) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:15905
 #7  0x000000000049efee in cp_parser_single_declaration (parser=0x7f7ff6035bb0, checks=0x0, member_p=false, explicit_specialization_p=false, friend_p=<optimized out>)
     at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:22127
 #8  0x000000000049e573 in cp_parser_template_declaration_after_export (parser=0x7f7ff6035bb0, member_p=false) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:21941
 #9  0x0000000000472bf7 in cp_parser_template_declaration (parser=0x7f7ff6035bb0, member_p=false) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:12226
 #10 cp_parser_declaration (parser=0x7f7ff6035bb0) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:10404
 #11 0x0000000000470c58 in cp_parser_declaration_seq_opt (parser=0x7f7ff6035bb0) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:10334
 #12 0x00000000004738d8 in cp_parser_namespace_body (parser=0x7f7ff6035bb0) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:15136
 #13 cp_parser_namespace_definition (parser=0x7f7ff6035bb0) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:15117
 #14 0x0000000000472b49 in cp_parser_declaration (parser=0x7f7ff6035bb0) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:10432
 #15 0x0000000000470c58 in cp_parser_declaration_seq_opt (parser=0x7f7ff6035bb0) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:10334
 #16 0x000000000046fcff in cp_parser_translation_unit (parser=<optimized out>) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:3813
 #17 c_parse_file () at /archive/foreign/src/external/gpl3/gcc/dist/gcc/cp/parser.c:28334
 #18 0x00000000005387a4 in c_common_parse_file () at /archive/foreign/src/external/gpl3/gcc/dist/gcc/c-family/c-opts.c:1046
 #19 0x000000000067c3aa in compile_file () at /archive/foreign/src/external/gpl3/gcc/dist/gcc/toplev.c:543
 #20 0x000000000067c207 in do_compile () at /archive/foreign/src/external/gpl3/gcc/dist/gcc/toplev.c:1864
 #21 toplev_main (argc=28, argv=0x7f7fffffd310) at /archive/foreign/src/external/gpl3/gcc/dist/gcc/toplev.c:1940
 #22 0x0000000000403059 in ___start ()
 #23 0x00007f7ff7c042c0 in ?? () at /archive/foreign/src/libexec/ld.elf_so/rtld.c:1426 from /libexec/ld.elf_so
 #24 0x00007f7ff7ffa000 in ?? ()
 #25 0x000000000000001c in ?? ()
 (lots more ??)

  Thomas

From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: Martin Husemann <martin@duskware.de>
Subject: Re: toolchain/48731: internal compiler error (wip/gambatte;
 g++/bits/basic_string.tcc)
Date: Thu, 10 Apr 2014 12:12:43 +0200

 martin@ suggested filing this upstream.
 The bug report there is
 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60807
  Thomas

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/48731: internal compiler error (wip/gambatte; g++/bits/basic_string.tcc)
Date: Thu, 10 Apr 2014 17:02:55 +0200

 I could build the pkg just fine (and it even works) on an amd64 machine
 I just updated.

 I also could compile the cpu.ii file with the command line you showed.

 Can you update your machine and try again? There have been a few libc
 string fixes in the last week or so.

 Martin

From: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/48731: internal compiler error (wip/gambatte;
 g++/bits/basic_string.tcc)
Date: Fri, 11 Apr 2014 16:45:40 +0200

 On Thu, Apr 10, 2014 at 03:05:00PM +0000, Martin Husemann wrote:
 >  I could build the pkg just fine (and it even works) on an amd64 machine
 >  I just updated.
 >  
 >  I also could compile the cpu.ii file with the command line you showed.
 >  
 >  Can you update your machine and try again? There have been a few libc
 >  string fixes in the last week or so.

 I already had all of these.

 martin could reproduce the problem after using clang to compile gcc,
 i.e. using build.sh with '-V DBG="-O2 -g" -V MKLLVM=yes -V
 HAVE_LLVM=yes -V MKLIBCXX=yes'. For him, the problem already appears in
 the pcre package.

 The gcc bug was closed; I've filed a bug against clang:

 http://llvm.org/bugs/show_bug.cgi?id=19401

  Thomas

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.